英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论