2016-06-14 6 views
16

は、このエラーが発生します。権限は正しいので、問題を見つけることができません。私はこれが私のコードとは関係ないと確信していますが、それが私には分かります。Firebase Android:内部エラーが発生しました。私はFirebaseコンソールでグーグルを有効にしている</p> <blockquote> <p>An internal error has occurred. [ OPERATION_NOT_ALLOWED ]</p> </blockquote> <p>:[OPERATION_NOT_ALLOWED]私のアプリケーションは、Google経由で署名

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(); 
      } 
     } 
    ); 
} 
+0

いくつかのコードを表示しますか? –

+1

@ jesses.co.ttコードは必要ありませんが、SignInActivityを追加します –

+0

これは明らかに_server_エラーです。 –

答えて

33

私は同じ問題を抱えていました。私は、フォーラム投稿[Google Auth] com.google.firebase.FirebaseException: An internal error has occurredの解決策を得ました。

コンソールのFirebaseで認証方法を有効にしていないときに、これが起こりました。 Google認証を有効にすると、[OPERATION_NOT_ALLOWED]がなくても同じ例外があります。 https://console.firebase.google.com/

  • +0

    私は二重チェックをしましたが、この解決策は私にはぴったりでした。私は前にそれを試してみましたが。私はあなたがGoogleグループhehからこのメッセージをコピーして貼り付けたと思いますか? –

    +0

    heheheはいソースを更新します。 –

    +0

    それを見て私をしばらく抱きました:) – Lancelot

    11
    1. 行くプロジェクトを選択します。
    2. 認証をクリックし、Googleでクリック
    3. SIGN-IN-METHODをクリック
    4. メニューオプションから、それを有効にします。

    は、それが正常に動作したより:)

    +1

    あなたは受け入れられた答えを見ることができません? –

    +2

    私のために働いた..答えをありがとう –

    +0

    Obrigado cara! colocar isso nadocumentação?セコロカラム、ficou muito oculto。 ありがとうございました!どのように彼らはドキュメンテーションにこれを入れるのを忘れたのですか?彼らがした場合、それは非常に隠されていた。 –

    0

    はあなたが使用しようとしているか、あなたのAPPで使用しているfirebase console上のSIGN-IN-METHODメソッドを有効にします。

    0

    電子メールとパスワードでサインアップしている場合は、以下の手順に従ってください。

    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. 
    
    0

    最後に、私のために働く解決策が見つかりました。実際には、電子メール+パスワードの認証方法を正常にセットアップしても、私の場合はモバイルアプリを作成してプロジェクトに関連付ける必要があります。その後、FireBaseは期待通りに動作します。

    関連する問題

     関連する問題