I am new to using firebase auth with providers so bear with me.
In the documentation for FirebaseAuth using microsoft, it says:
* Authenticate with Firebase using the OAuth provider object. Note that unlike other FirebaseAuth operations, this will take control of your UI by popping up a Custom Chrome Tab. As a result, do not reference your Activity in the OnSuccessListener and OnFailureListener that you attach as they will immediately detach when the operation starts the UI.*
I am not quite sure what it means by "do not reference your Activity". Does it mean I cannot start an activity in the onSuccess listener? if so what is the proper way for me to redirect the users to another activity?
firebaseAuth
.startActivityForSignInWithProvider(/* activity= */ this, provider.build())
.addOnSuccessListener(
new OnSuccessListener<AuthResult>() {
@Override
public void onSuccess(AuthResult authResult) {
// User is signed in.
// DO I NOT REDIRECT THE USER HERE?
Intent intent= new Intent(AuthActivity.this,MainActivity.class);
startActivity(intent);
//Is the above a code a No-No?
}
})
.addOnFailureListener(
new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
// Handle failure.
}
});