firebase / firebase-android-sdk

Firebase Android SDK
https://firebase.google.com
Apache License 2.0
2.27k stars 575 forks source link

Can't login through provider from DialogFragment #2033

Open NatalyTsivileva opened 4 years ago

NatalyTsivileva commented 4 years ago

Describe your environment

Android Studio version: 4.1 RC 1 Firebase Component: Firebase Authentication Component version: 19.3.2

Describe the problem

Hello. I have the problem. When i try to sign in by startActivityForSignInWithProvider() method :

 val provider = OAuthProvider.newBuilder("twitter.com").build()
            Firebase.auth
                .startActivityForSignInWithProvider(this, provider)
                .addOnSuccessListener {
                    onSignInSuccess()
                    saveAuthorizationData(it.toRealmAuthorization())
                }
                .addOnFailureListener { onSignInError(it) }

from Activity/Fragmen - It's all right. I can log in with my Twitter provider. But (!) when i try to sign in from DialogFragment, which nested into parent fragment, application is stops working. There is no information in logs.

That's what's going on: The android application first redirects me to the browser. In browser I sign in into Twitter account, then it starts redirecting me to the application again. I see progress bar, than dimmed desktop screen. Since that moment nothing happens. Please help, because it makes no sense to call an authorization request outside the dialog. 1 2

google-oss-bot commented 4 years ago

I found a few problems with this issue:

mitaligupta07 commented 3 years ago

firebaseAuth.createUserWithEmailAndPassword(email,paasword1).addOnCompleteListener(this, new OnCompleteListener() { @Override public void onComplete(@NonNull Task task) { if(task.isSuccessful()){ Toast.makeText(Register.this,"Successfully registered",Toast.LENGTH_LONG).show(); Intent intent= new Intent(Register.this, SelectClub.class); startActivity(intent); finish(); } else{ Toast.makeText(Register.this,"Sign up failed", Toast.LENGTH_LONG).show(); } progressDialog.dismiss();

Try to use this code, it might work

yuchenshi commented 3 years ago

I've tracked this internally as b/176911305.