+-

在Google Smart Lock密码中存储Facebook凭据
我能够在Smart Lock密码中存储基本的用户名/密码凭据.有很多有关Google凭证的文档和示例:
GoogleSignInAccount gsa = signInResult.getSignInAccount();
Credential credential = new Credential.Builder(gsa.getEmail())
.setAccountType(IdentityProviders.GOOGLE)
.setName(gsa.getDisplayName())
.setProfilePictureUri(gsa.getPhotoUrl())
.build();
但是到目前为止,我还无法存储Facebook凭据.应该是类似的东西.但是到底是什么?还是完全不同或不受支持?
Credential credential = new Credential.Builder(<what goes here?!>)
.setAccountType(IdentityProviders.FACEBOOK)
.setName(<and here?>)
.setProfilePictureUri(<is this necessary?>)
.build();
最佳答案
我能够得到我认为是Smart Lock的工作版本,可以保存Facebook登录凭据.
我的应用程序使用FB API登录.从那里,我将令牌发送到服务器,服务器又将用户的电子邮件和用户名发回给我.我这样存储该信息:
Credential credential = new Credential.Builder(user.getEmail())
.setAccountType(IdentityProviders.FACEBOOK)
.setName(user.getName())
.build();
我对Facebook API并不完全熟悉,但是我认为您可以从Facebook SDK中获取电子邮件和用户名.
使用此方法保存用户FB凭据后,我可以在passwords.google.com上查看它们.密码显示为“ With Facebook”.
点击查看更多相关文章
转载注明原文:在Android中将Facebook凭据存储为Google Smart Lock密码 - 乐贴网