I am trying to use the Firestore HTTP REST APIs from React Native.
I am only using HTTP (no SDK).
After the user has logged in with Google Signin (react-native-google-signin), I have an idToken
and accessToken
.
I want to be able to convert one of these into a Firebase idToken
that can be used in the 'Authorization': 'Bearer ${firebaseIdToken}'
HTTP header using only the Firebase REST HTTP APIs
https://firebase.google.com/docs/reference/rest/auth/#section-verify-custom-token
- Input "token"="A Firebase Auth custom token".
- Neither
idToken
oraccessToken
from the Google Signin work here. - Do I need to send the Google
idToken
to the server to convert it to a Firebase AuthidToken
?
- Neither
Before I was using these SDK calls for auth:
const cred = firebase.auth.GoogleAuthProvider.credential(idToken, accessToken);
await firebase.auth().signInAndRetrieveDataWithCredential(cred)
const firebaseIdToken = await firebase.auth().currentUser.getIdToken();
const headers = {
'Authorization': `Bearer ${firebaseIdToken}`
}
Related links
https://github.com/react-native-community/react-native-google-signin https://firebase.google.com/docs/auth/admin/create-custom-tokens