Firebase Gmail登录中,`googleCredential.getId()`返回的是否始终是电子邮件地址?

huangapple go评论96阅读模式
英文:

Firebase Gmail Login googleCredential.getId() is it always email?

问题

我已经使用Firebase实现了一个使用Gmail One Tap登录的功能,参考了以下文档

在选择账户后:

SignInCredential credential = signInClient.getSignInCredentialFromIntent(data);
credential.getId()  // 这个id

这个credential id就是我的Gmail账户。我想确认的是,这个id是否总是邮箱地址。

英文:

I have implemented a Gmail One Tap login using Firebase using the following documentation.

After account selection:

SignInCredential credential = signInClient.getSignInCredentialFromIntent(data);
credential.getId()  // this id

The credential id is my Gmail account. What I would like to confirm is whether that is always email.

答案1

得分: 0

根据你的最后一条评论:

> 但是ID是电子邮件。我想确认ID是否总是电子邮件?

根据SignInCredential#getId()方法的官方文档:

> 返回凭据的标识符。对于ID令牌凭据,这将返回用户帐户的电子邮件地址,对于基于密码的凭据,它将返回该密码的用户名

所以不,它不一定总是电子邮件。它也可能是用户名。

英文:

According to your last comment:

> But the id is email. I want to confirm that ID is always email?

According to official documentation of the SignInCredential#getId() method:

> Returns the identifier of the credential. For an ID token credential, this returns the email address of the user's account and for a password-backed credential, it returns the username for that password.

So not, it is not always the email. It might also be a username.

huangapple
  • 本文由 发表于 2023年8月9日 01:16:21
  • 转载请务必保留本文链接:https://go.coder-hub.com/76861848.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定