-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AuthUI: Method to get provider id #329
Comments
Have you tried |
As for I was looking specifically for a method which returns what provider was used to sign in for that instance. I could use the existing providers as a workaround, checking if facebook exists and updating user info via facebook, and same for google - but I'd rather use the provider that the user has chosen to login with at the time. So, I think it would be helpful if AuthUI could store which provider was used to login with. |
The Also the reason why |
@tikurahul Thank you for the clarification. Using |
problem is solved by using this - FirebaseAuth mAuth = FirebaseAuth.getInstance(); String provider = user.getProviders().get(0); |
I ran into this also. Seems to be a list now, so user.getProviders().get(0) works. |
my user is logged in by facebook then also getProviderData().get(0) returning com.google.firebase so I used mAuth.getCurrentUser().getProviders().get(0) so simply strore returning value in string variable(let say provider) and add condition like below: //add logic for google provider }else if(provider.contains("facebook")){ //add logic for google provider } |
To solve this problem, now you need to use you can find it in this docs : https://firebase.google.com/docs/reference/android/com/google/firebase/auth/FirebaseUser.html#getProviderData()
Snippet
|
I have a problem with Firebase Auth 5.0. Value of type 'AuthDataResult' has no member 'providerID' |
All the above solutions (the one mentioned by @grennis and the one mentioned by @tikurahul) don't seem to work any longer. I am using firebase auth |
It seems above answer is deprecated recent solution is: As noted here
and for display in page
|
It is possible to get used provider from Start UI: Intent authUIIntent = AuthUI.getInstance().createSignInIntentBuilder().build();
getCurrentActivity().startActivityForResult(authUIIntent, RC_SIGN_IN); And listen for result: private final ActivityEventListener mActivityEventListener = new BaseActivityEventListener() {
@Override
public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) {
if (requestCode == RC_SIGN_IN) {
IdpResponse response = IdpResponse.fromResultIntent(data);
String providerType = response.getProviderType();
// ...
}
}
} |
The following returns the currently used provider ("google.com", "password", ...) as a string.
where the |
This didnt work in POCO M2 |
Is there a method to get which provider was used to authenticate?
I'm trying to get additional information about the user from their facebook/google profile but cannot seem to find a method which returns the provider used to authenticate.
This will be a useful feature.
The text was updated successfully, but these errors were encountered: