I am using Firebase Auth for login and sign up. I am trying to integrate google sign in. Now I have gotten a google Oauth ID that I need to convert into a Firebase ID token so that I can sign in using the authroization header.
const FirebaseIdToken = `Bearer ${token}`;
localStorage.setItem("FirebaseIdToken", FirebaseIdToken);
API.defaults.headers.common["Authorization"] = FirebaseIdToken;
I am following this link: https://firebase.google.com/docs/reference/rest/auth/#section-sign-in-with-oauth-credential to get a post request but I am having trouble doing it.
const data = {
postBody: token, //Google Oauth token
};
API.post(
`https://identitytoolkit.googleapis.com/v1/accounts:signInWithIdp?key=[API-KEY]`,
{ data }
).then((res) => {
console.log(res);
console.log(res.data);
});
I just get a Post 400 error. The body also asks for a requestUri which I'm not sure what that is.