无法将读取权限(电子邮件)传递给发布授权请求

时间:2018-12-16 20:54:55

标签: firebase firebase-authentication facebook-login

我正在尝试通过Firebase身份验证使用Facebook登录。我遵循了整个文档。最后,每当我单击登录按钮时,都会显示错误消息:

Cannot pass a read permission (email) to a request for publish authorization

显示错误的行是:

LoginManager.getInstance().logInWithPublishPermissions(LoginActivity.this,Arrays.asList("email", "public_profile"));

有人可以向我解释我做错了什么吗?我也看过其他答案,但那里没有帮助。

2 个答案:

答案 0 :(得分:1)

使用date代替logInWithReadPermissions。该错误消息非常清楚,您正在尝试使用用于发布权限的功能来请求读取权限。

答案 1 :(得分:0)

.getInstance().logInWithPublishPermissions不是Firebase身份验证。通过Firebase JavaScript(web)SDK,可以通过Facebook之类的联合提供程序登录。有关详细信息,请参见Authenticate Using Facebook Login with JavaScript

firebase.auth().signInWithPopup(provider).then(function(result) {
  // This gives you a Facebook Access Token. You can use it to access the Facebook API.
  var token = result.credential.accessToken;
  // The signed-in user info.
  var user = result.user;
  // ...
}).catch(function(error) {
  // Handle Errors here.
  var errorCode = error.code;
  var errorMessage = error.message;
  // The email of the user's account used.
  var email = error.email;
  // The firebase.auth.AuthCredential type that was used.
  var credential = error.credential;
  // ...
});