简体   繁体   中英

Firebase SignIn Using a Token from REST API

I have whole project using Firebase REST API but I want start using Firebase SDKs (iOS/Android) without stop using Authentication REST API. I have access to this tokens:

  • access_token
  • id_token
  • refresh_token

Can I use them to log into Firebase Authentication SDKs iOS or/and Android? If yes, how?

Regards

These are only applicable through the rest API as you will have to authenticate within the module to invoke the user auth process.

To break it down, the access_token and id_token as interchangeable, the refresh token allows the client to request new a id_token when it expires or invoked manually. But to my knowledge, there is no way to manually inject a refresh token into the auth state and would require something like the admin-sdk to create a custom auth token for cross-platform authentication.

In that situation, I would recommend a cloud function and using the custom auth to validate the user to migrate from the rest API to the firebase modules.

All you need to do is create a Cloud Function that on invoke, gets the users current Auth.uid (would be done with your provided id_token ) - With the users uid , you can create a custom sign-in token that being said, you can also sign in with a 3rd party JWT, but this is not recommended.

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