Javascript Firebase web在Google和Facebook中获取提供商数据(性别和生日)
这是我的谷歌部分Javascript Firebase web在Google和Facebook中获取提供商数据(性别和生日),javascript,facebook,firebase,firebase-authentication,google-login,Javascript,Facebook,Firebase,Firebase Authentication,Google Login,这是我的谷歌部分 var provider = new firebase.auth.GoogleAuthProvider(); firebase.auth().languageCode = 'zh-TW'; provider.addScope('profile'); provider.addScope('https://www.googleapis.com/auth/userinfo.profile'); provider.addScope('https://www.googleapis.com
var provider = new firebase.auth.GoogleAuthProvider();
firebase.auth().languageCode = 'zh-TW';
provider.addScope('profile');
provider.addScope('https://www.googleapis.com/auth/userinfo.profile');
provider.addScope('https://www.googleapis.com/auth/userinfo.email');
provider.addScope('https://www.googleapis.com/auth/plus.login');
provider.addScope('https://www.googleapis.com/auth/plus.me');
provider.addScope('https://www.googleapis.com/auth/user.birthday.read');
provider.addScope('email');
firebase.auth().signInWithPopup(provider).then(function(result) {
console.log(result.user)
}).catch(function(error) {
app.message.register = error.message;
});
这是我在Facebook上的部分
var provider = new firebase.auth.FacebookAuthProvider();
provider.addScope('user_birthday');
firebase.auth().languageCode = 'zh-TW';
firebase.auth().signInWithPopup(provider).then(function(result) {
console.log(result.user)
}).catch(function(error) {
});
这两部分没有在
控制台.log(result.user)
中获取性别和生日信息,是否缺少一些设置?或者是有错误的部分?有什么想法吗?返回的访问令牌result.credential.accessToken
将提供对这些附加作用域的访问。您需要使用该访问令牌查询Google/Facebook API以获取该数据(特定于请求的其他作用域)。顺便说一下,现在会返回一些特定于IdP的附加用户信息。检查result.additionalUserInfo.profile的内容
太宽泛了,两个平台都有点不同。你知道facebook上的登录评论吗?您是否在登录过程中被要求获得生日权限?您能否提供一个示例查询?InResult.additionalUserInfo不是生日或性别使用这个很棒的工具了解如何使用API