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

后端 未结 7 2377
星月不相逢
星月不相逢 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条回答
  •  眼角桃花
    2021-02-08 11:25

    getToken is deprecated now. You should use getIdToken instead:

    this.af.auth.currentUser.getIdToken(true)
      .then((token) => localStorage.setItem('tokenId', token));
    

提交回复
热议问题