Firebase身份验证-Facebook登录不会返回用户信息

时间:2019-03-21 01:02:27

标签: javascript firebase cordova firebase-authentication

我有一个cordova项目,并通过Facebook进行身份验证后得到空用户

这是流程。

  1. 我已重定向到登录屏幕

  2. 输入电子邮件和密码

  3. 显示一个屏幕以单击继续按钮确认我的登录

  4. 选择“继续”按钮后,我将被重定向回应用程序

  5. 结果-用户=空

科尔多瓦-8.1.2版 Firebase SDK-5.9.0

这是我的按钮代码

var provider = new firebase.auth.FacebookAuthProvider();
$rootScope.user  = firebase.auth().currentUser;
if ($rootScope.user) {
  $rootScope.openCommonAlertModal({
  title: 'Sign in Success',
  details: "user log in as "+$rootScope.user.email
 }); 
 $scope.closeSignIn();
 $rootScope.$broadcast('signInEvent');
 } else {
   firebase.auth().signInWithRedirect(provider).then(function () {
    return firebase.auth().getRedirectResult();
 }).then(function (result) {
 var token = result.credential.accessToken;
 $rootScope.user = result.user;
 $rootScope.openCommonAlertModal({
    title: 'Sign in Success',
    details: "user log in as "+$rootScope.user.email
  }); 
  $scope.closeSignIn();
  $rootScope.$broadcast('signInEvent');
}).catch(function (error) {
 var errorCode = error.code;
 var errorMessage = error.message;

 $rootScope.openCommonAlertModal({
     title: 'Sign in failure',
      details: errorMessage + errorCode
  }); 
});
}

0 个答案:

没有答案