发送好友请求需要在Facebook对话框中重新登录

时间:2019-06-24 10:29:43

标签: javascript firebase firebase-authentication facebook-login

我在应用程序中使用FirebaseFacebook登录。

要登录该应用程序,我使用以下代码:

this.fb.login(['public_profile', 'user_photos', 'email', 'user_friends']).then((res: FacebookLoginResponse) => {
  let user_facebook_id = res.authResponse.userID;
  const facebookCredential = firebase.auth.FacebookAuthProvider
    .credential(res.authResponse.accessToken);

  firebase.auth().signInWithCredential(facebookCredential)
    .then( success => { 
      console.log("Firebase success: " + JSON.stringify(success));
      this.userData = success.user;
      this.nativeStorage.setItem("uid",this.userData.uid);
      this.nativeStorage.setItem("accesstoken",res.authResponse.accessToken);
      this.fcm.getToken().then(token => { this.token_id = token; })
      let finer_photo = this.userData.photoURL+"?type=large"
      let body = {displayname:this.userData.displayName,uid:this.userData.uid,photoURL:finer_photo,email:this.userData.email,facebook_id:user_facebook_id,token_id:this.token_id};
      console.log(body);
      this.ser.addUser(body).then(res => {
        console.log(res);
        let body = {uid: this.userData.uid}
        this.ser.doesUserExists(body).then(res => {
         console.log(res);
         if(res == undefined){
        //  this.dismiss();
          this.navCtrl.navigateForward('/registeruser');
         }else{
        //  this.dismiss();
          this.navCtrl.navigateForward('/main-page');
         }
 });


    },err =>{
        console.log(err);
    });
    });
 });

我想使用以下代码向我的朋友发送游戏请求...

this.fb.showDialog({method: "apprequests", message: "Some Message"}).then(success => {
      let data :any= success;
      let reciepientsList:any[] = data.recipientsIds;

每次调用showDialog()时,它都会打开一个弹出窗口以登录我的Facebook帐户,而不显示我的朋友。

需要注意的是,我正在使用firebase Auth对用户进行身份验证。
有人可以告诉我我做错了什么吗?
谢谢。

0 个答案:

没有答案