17

Signing in via Google in my application gives this error:

An internal error has occurred. [ OPERATION_NOT_ALLOWED ]

I have enabled Google in the Firebase console. Permissions are correct, and I can't seem to find the problem. I'm sure this has nothing to do with my code, but if it does tell me.

SignInactivity:

@Override
public void onClick(View v) {
    switch (v.getId()) {
        case R.id.sign_in_button:
            signIn();
            break;
    }
}

private void signIn() {
    Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
    startActivityForResult(signInIntent, RC_SIGN_IN);
}

@Override
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
    // An unresolvable error has occurred and Google APIs (including Sign-In) will not
    // be available.
    Log.d(TAG, "onConnectionFailed:" + connectionResult);
    Toast.makeText(this, "Google Play Services error.", Toast.LENGTH_SHORT).show();
}

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    // Result returned from launching the Intent from GoogleSignInApi.getSignInIntent(...);
    if (requestCode == RC_SIGN_IN) {
        GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
        if (result.isSuccess()) {
            // Google Sign In was successful, authenticate with Firebase
            GoogleSignInAccount account = result.getSignInAccount();
            firebaseAuthWithGoogle(account);
        } else {
            // Google Sign In failed
            Log.e(TAG, "Google Sign In failed.");
        }
    }
}

private void firebaseAuthWithGoogle(GoogleSignInAccount acct) {
    Log.d(TAG, "firebaseAuthWithGooogle:" + acct.getId());
    AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(), null);
    mFirebaseAuth.signInWithCredential(credential).addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {

       @Override
       public void onComplete(@NonNull Task<AuthResult> task) {
           Log.d(TAG, "signInWithCredential:onComplete:" + task.isSuccessful());

           // If sign in fails, display a message to the user. If sign in succeeds
           // the auth state listener will be notified and logic to handle the
           // signed in user can be handled in the listener.
           if (!task.isSuccessful()) {
               Log.w(TAG, "signInWithCredential", task.getException());
               Toast.makeText(SignInActivity.this, "Authentication failed: " + task.getException(),
                       Toast.LENGTH_SHORT).show();
           } else {
               startActivity(new Intent(SignInActivity.this, MainActivity.class));
               finish();
           }
       }
    );
}
7
  • 1
    @jesses.co.tt code isn't needed, but I'll add my SignInActivity Commented Jun 14, 2016 at 16:17
  • This is obviously a server error, nothing else. Commented Jun 14, 2016 at 16:18
  • 3
    If you are "sure this has nothing to do with [your] code", how do you expect us to help you? We can't exactly ask Google to fix something on their servers -- all we can do is deal with your code. Commented Jun 14, 2016 at 16:29
  • 1
    @hichris123 nah man, this is obviously a server error with Firebase, I need to enable or disable something. Did you even look at the error message? Commented Jun 14, 2016 at 19:45
  • 1
    @hichris123 Well, I gave you code anyways. Firebase has been tiring me out lately - it has so many bugs. Defiantly going to reconsider using it Commented Jun 14, 2016 at 19:48

7 Answers 7

40

I had the same problem. I got the solution in the forum post [Google Auth] com.google.firebase.FirebaseException: An internal error has occurred.

This happened to me when I did not have the authentication method enabled in the console Firebase. When I enabled Google authentication, I got the same exception, just without [OPERATION_NOT_ALLOWED].

Sign up to request clarification or add additional context in comments.

3 Comments

Although I double-checked, this solution was right for me. Although I did try it before. I'm guessing you copied and pasted this message from the google groups heh?
Took me a while to see it :)
33 upvotes for such a small question. Proves how small answers can have huge impact :)
15
  1. Go to https://console.firebase.google.com/
  2. Select your project.
  3. Click on Authentication from menu option
  4. Click on SIGN-IN-METHOD
  5. Click on Google and enable it.

Than it works fine :)

2 Comments

Obrigado cara! como que esqueceram de colocar isso na documentação? Se colocaram, ficou muito oculto. Thanks man! How come they forgot to put this in the documentation? If they did, it was very hidden.
It is currently enabled :/
2

If you are signup with email and password then follow below steps.

Go to https://console.firebase.google.com/
Select your project.
Click on Authentication from menu option(Right-side menu)
Click on SIGN-IN-METHOD
Click on Email/Password and enable it.
Click on SAVE.

Comments

1

Enable the SIGN-IN-METHOD method on firebase console which you are going to use or you are using in your APP.

Comments

1

I got "Internal error has occurred" when run the project. Please make sure your emulator connect with internet. In my case my emulator didn't connect with internet. for that following these steps.(For Windows PC)

  1. Go to the WiFi settings.
  2. Change adapter options.
  3. Right click WiFi and go to the properties.
  4. Then go to the sharing tab.
  5. Checked these two components and press OK.

Then in emulator, switch off WiFi and switch on again. It's worked for me.

Comments

0

finally I found the solution which worked for me. The fact is that even when you have setup successfully the email+password auth method you need to create a mobile app(in my case) and associate it with your project. After that FireBase will work as expected.

Comments

0

Go to Google "https://console.developers.google.com/apis/library/" to your project and enable Identity Toolkit API

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.