Java Code Examples for com.google.android.gms.auth.api.credentials.Credential#getId()
The following examples show how to use
com.google.android.gms.auth.api.credentials.Credential#getId() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PhoneNumberHelper.java From react-native-sms-retriever with MIT License | 6 votes |
@Override public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) { super.onActivityResult(activity, requestCode, resultCode, data); if (requestCode == REQUEST_PHONE_NUMBER_REQUEST_CODE) { if (resultCode == Activity.RESULT_OK) { final Credential credential = data.getParcelableExtra(Credential.EXTRA_KEY); final String phoneNumber = credential.getId(); promiseResolve(phoneNumber); callAndResetListener(); return; } } promiseReject(ACTIVITY_RESULT_NOOK_ERROR_TYPE, ACTIVITY_RESULT_NOOK_ERROR_MESSAGE); callAndResetListener(); }
Example 2
Source File: CheckEmailHandler.java From FirebaseUI-Android with Apache License 2.0 | 6 votes |
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { if (requestCode != RequestCodes.CRED_HINT || resultCode != Activity.RESULT_OK) { return; } setResult(Resource.<User>forLoading()); final Credential credential = data.getParcelableExtra(Credential.EXTRA_KEY); final String email = credential.getId(); ProviderUtils.fetchTopProvider(getAuth(), getArguments(), email) .addOnCompleteListener(new OnCompleteListener<String>() { @Override public void onComplete(@NonNull Task<String> task) { if (task.isSuccessful()) { setResult(Resource.forSuccess(new User.Builder(task.getResult(), email) .setName(credential.getName()) .setPhotoUri(credential.getProfilePictureUri()) .build())); } else { setResult(Resource.<User>forFailure(task.getException())); } } }); }
Example 3
Source File: SignInKickstarter.java From FirebaseUI-Android with Apache License 2.0 | 5 votes |
private void handleCredential(final Credential credential) { String id = credential.getId(); String password = credential.getPassword(); if (TextUtils.isEmpty(password)) { String identity = credential.getAccountType(); if (identity == null) { startAuthMethodChoice(); } else { redirectSignIn( ProviderUtils.accountTypeToProviderId(credential.getAccountType()), id); } } else { final IdpResponse response = new IdpResponse.Builder( new User.Builder(EmailAuthProvider.PROVIDER_ID, id).build()).build(); setResult(Resource.<IdpResponse>forLoading()); getAuth().signInWithEmailAndPassword(id, password) .addOnSuccessListener(new OnSuccessListener<AuthResult>() { @Override public void onSuccess(AuthResult result) { handleSuccess(response, result); } }) .addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { if (e instanceof FirebaseAuthInvalidUserException || e instanceof FirebaseAuthInvalidCredentialsException) { // In this case the credential saved in SmartLock was not // a valid credential, we should delete it from SmartLock // before continuing. GoogleApiUtils.getCredentialsClient(getApplication()) .delete(credential); } startAuthMethodChoice(); } }); } }