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

后端 未结 7 2178
星月不相逢
星月不相逢 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:38

    With AngularFire2, you can get the token like this :

    this.af.auth.getToken() // returns a firebase.Promise
    

    If you want to get an ES6 Promise instead, just use

    Promise.resolve()
      .then(() => this.af.auth.getToken() as Promise)
    

提交回复
热议问题