Solving 403 error firebase-authentication
🎈

Solving 403 error firebase-authentication

Date
Jun 29, 2022
Tags
React
Recently came across a very tedious error while trying to create a signin page using firebase auth using google sign in
The popup would close momentarily and close down again
When I checked the console, this was the error:
const loginWithGoogle = () => { signInWithRedirect(auth, provider).then(() => { getRedirectResult(auth) .then(result => { // This gives you a Google Access Token. You can use it to access Google APIs. const credential = GoogleAuthProvider.credentialFromResult(result); const token = credential.accessToken; // The signed-in user info. const user = result.user; console.log(user); }) .catch(error => { // Handle Errors here. const errorCode = error.code; const errorMessage = error.message; // The email of the user's account used. const email = error.email; // The AuthCredential type that was used. const credential = GoogleAuthProvider.credentialFromError(error); // ... }); }); };
The fix:
Make sure that the API key in credentials is set to β€œDon’t restrict this key”
notion image