ColeB
ColeB

Reputation: 31

Firebase Google Authentication Says: Access blocked: This app’s request is invalid

I have linked my domain in the firebase authentication, and I have allowed access for auth too.

If you would like to try it, here is the link https://colesprojects.ml/signin/

signInWithPopup(auth, provider)
  .then((result) => {
    // This gives you a Google Access Token. You can use it to access the Google API.
    const credential = GoogleAuthProvider.credentialFromResult(result);
    const token = credential.accessToken;
    // The signed-in user info.
    const user = result.user;


    alert(user.displayName);
    // ...
  }).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);
    // ...

    alert(errorMessage);
  });
 });

Here is my code if I am doing something wrong.

Upvotes: 1

Views: 5459

Answers (1)

Eliott Bouvard
Eliott Bouvard

Reputation: 180

Looking at the error, it seems to me you didn't add your domain to your Authorized redirect URIs. Go to the GCP console Credentials configuration, in the OAuth 2.0 Client IDs section select your app and add your redirect url to the Authorized redirect URIs section at the bottom (here your redirect URI would be https://colesprojects.ml/__/auth/handler as stated in the error). Error 400: redirect_uri_mismatch

Upvotes: 2

Related Questions