0

When I try to sign in with google account by FirebaseUI, I always get 12500 error. In addition, if I try to login through another Google account which is not mine it asks me for a password. I tried to write my password account and it did not accept that.

I really tried every solution that I found in the network. I tried to replace and edit my google-json file, change and edit my SHA-1 code and to create another OAuth Client ID and nothing helps.

public class Login2 extends AppCompatActivity {

    List<AuthUI.IdpConfig> providers;
    private static final int MY_REQUEST_CODE=1111;
    private static final int RC_SIGN_IN=1;
    private String TAG="Activity";
    FirebaseAuth firebaseAuth;
    Button signOut;



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login2);

        firebaseAuth= FirebaseAuth.getInstance();

        try {
            PackageInfo info = getPackageManager().getPackageInfo(
                    "com.example.allergyalert",
                    PackageManager.GET_SIGNATURES);
            for (Signature signature : ((PackageInfo) info).signatures) {
                MessageDigest md = MessageDigest.getInstance("SHA");
                md.update(signature.toByteArray());
                Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
            }
        } catch (PackageManager.NameNotFoundException e) {

        } catch (NoSuchAlgorithmException e) {

        }

        signOut=findViewById(R.id.signOutTestBtn);
        signOut.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                AuthUI.getInstance().signOut(Login2.this).addOnCompleteListener(new OnCompleteListener<Void>() {
                    @Override
                    public void onComplete(@NonNull Task<Void> task) {
                        signOut.setEnabled(false);
                        showSignInOptions();
                    }
                }).addOnFailureListener(new OnFailureListener() {
                    @Override
                    public void onFailure(@NonNull Exception e) {
                        Toast.makeText(Login2.this, ""+e.getMessage(), Toast.LENGTH_SHORT).show();
                    }
                });
            }
        });

        providers= Arrays.asList(
                new AuthUI.IdpConfig.EmailBuilder().build(),
                new AuthUI.IdpConfig.GoogleBuilder().build(),
                new AuthUI.IdpConfig.FacebookBuilder().build()

        );

    }

    public void showSignInOptions() {
        startActivityForResult(
                AuthUI.getInstance()
                        .createSignInIntentBuilder()
                        .setAvailableProviders(providers)
                        .build(),
                MY_REQUEST_CODE);
    }
    public void userLoggedIn(){
        if(firebaseAuth.getCurrentUser() == null){
            showSignInOptions();

        }
    }


    @Override
    protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if(requestCode==MY_REQUEST_CODE)
        {
            IdpResponse response= IdpResponse.fromResultIntent(data);
            if(resultCode==RESULT_OK)
            {
                FirebaseUser user= FirebaseAuth.getInstance().getCurrentUser();
                Toast.makeText(this, ""+user.getEmail(), Toast.LENGTH_SHORT).show();
                signOut.setEnabled(true);
            }
            else
            {
                Toast.makeText(this, ""+response.getError().getMessage(), Toast.LENGTH_SHORT).show();
            }
        }


    }
}
Markus Kauppinen
  • 3,025
  • 4
  • 20
  • 30
Matan
  • 13
  • 1
  • 3
  • If you've tried everything listed in the duplicate and it still doesn't work, contact Firebase support so they can collect information about your project. – Doug Stevenson Jul 19 '19 at 15:13

1 Answers1

0

Simply update your Google Play Services to the latest version (or 11720000 in this case). If you are using AVD, Nexus 5 and 5X images support Google Play. Once the emulator is up and running, go to the Extended Controls Menu > Google Play then update.

refer this link to more information: Google Sign In error 12500

Sachin Muthumala
  • 775
  • 1
  • 9
  • 17