Firebase的FacebookAuthProvider.addScope做了什么?是否需要检索访问令牌?
答案 0 :(得分:1)
这用于添加Facebook OAuth 2.0范围,例如:' public_profile',' email',' user_likes',' user_friends'等 例如:
var provider = new firebase.auth.FacebookAuthProvider();
provider.addScope('user_friends');
provider.addScope('user_likes');
// This will open the Facebook sign in page and ask user to consent
// to the additional scopes.
firebase.auth().signInWithPopup(provider).then(function(result) {
if (result.user) {
// Additional user info like Facebook account url, gender, etc.
console.log(result.additionalUserInfo.profile);
// Facebook access token returned in the process
// for the scopes requested.
console.log(result.credential.accessToken);
}
});