How do I get the current user's access token in AngularFire2?

后端 未结 7 2307
星月不相逢
星月不相逢 2021-02-08 11:10

In AngularFire you were able to access the providers (e.g Google) accessToken for the authenticated user.

There does not seem to be a way to access this with AngularFire

7条回答
  •  Happy的楠姐
    2021-02-08 11:24

    googleSignIn() {
    
        return this.af_auth.auth.signInWithPopup(new firebase.auth.GoogleAuthProvider())
          .then(res => {
    
            // retrieve access token 
            const AccessToken = res.credential['accessToken'];
            console.log("Access token: ", AccessToken);
    
    
          })
          .catch(error => {
            console.log(error.message);
          });

提交回复
热议问题