简体   繁体   中英

Facebook login with ionic4 fails

I've added facebook login to my ionic 4 application. It is working good on some devices, but most of the devices are not working.

what happens that it just load when the user clicks the button then back again to the same page. without opening Facebook to authorize or any other response.

Here is my code:

  facebookLogin(): Promise<any> {
    return this.facebook.login(['email'])
    .then( response => {
      const facebookCredential = firebase.auth.FacebookAuthProvider
        .credential(response.authResponse.accessToken);

      firebase.auth().signInWithCredential(facebookCredential)
        .then( success => { 
          console.log("Firebase success: " + JSON.stringify(success)); 
          this.isLogged = true;
          // tslint:disable-next-line: no-unused-expression
          this.router.navigate(['']);
          console.log('logged in');
        });

    }).catch((error) => { console.log(error) });
  }

UPDATE

I noticed that something flashes very fast as it opens facebook authorizing dialogue but closes it right away without waiting for the user to accept or not.

发现导致问题的原因不是将我的facebook应用设置为处于开发模式!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM