use of com.google.firebase.auth.FirebaseAuth in project FirebaseUI-Android by firebase.
the class AuthUiActivity method onResume.
@Override
protected void onResume() {
super.onResume();
FirebaseAuth auth = FirebaseAuth.getInstance();
if (auth.getCurrentUser() != null && getIntent().getExtras() == null) {
startSignedInActivity(null);
finish();
}
}
use of com.google.firebase.auth.FirebaseAuth in project FirebaseUI-Android by firebase.
the class GenericIdpSignInHandler method handleNormalSignInFlow.
protected void handleNormalSignInFlow(final FirebaseAuth auth, final HelperActivityBase activity, final OAuthProvider provider) {
final boolean useEmulator = activity.getAuthUI().isUseEmulator();
auth.startActivityForSignInWithProvider(activity, provider).addOnSuccessListener(authResult -> handleSuccess(useEmulator, provider.getProviderId(), authResult.getUser(), (OAuthCredential) authResult.getCredential(), authResult.getAdditionalUserInfo().isNewUser())).addOnFailureListener(e -> {
if (e instanceof FirebaseAuthException) {
FirebaseAuthError error = FirebaseAuthError.fromException((FirebaseAuthException) e);
if (e instanceof FirebaseAuthUserCollisionException) {
FirebaseAuthUserCollisionException collisionException = (FirebaseAuthUserCollisionException) e;
setResult(Resource.forFailure(new FirebaseUiUserCollisionException(ErrorCodes.ERROR_GENERIC_IDP_RECOVERABLE_ERROR, "Recoverable error.", provider.getProviderId(), collisionException.getEmail(), collisionException.getUpdatedCredential())));
} else if (error == FirebaseAuthError.ERROR_WEB_CONTEXT_CANCELED) {
setResult(Resource.forFailure(new UserCancellationException()));
} else {
setResult(Resource.forFailure(e));
}
} else {
setResult(Resource.forFailure(e));
}
});
}
Aggregations