use of com.google.firebase.auth.ActionCodeSettings in project FirebaseUI-Android by firebase.
the class AuthUITest method testSignInIntentBuilder_anonymousUpgradeWithEmailLinkCrossDevice_expectThrows.
@Test(expected = IllegalStateException.class)
public void testSignInIntentBuilder_anonymousUpgradeWithEmailLinkCrossDevice_expectThrows() {
ActionCodeSettings actionCodeSettings = ActionCodeSettings.newBuilder().setUrl(URL).build();
IdpConfig config = new IdpConfig.EmailBuilder().enableEmailLinkSignIn().setActionCodeSettings(actionCodeSettings).build();
AuthUI.getInstance().createSignInIntentBuilder().setAvailableProviders(Arrays.asList(config)).enableAnonymousUsersAutoUpgrade();
}
use of com.google.firebase.auth.ActionCodeSettings in project FirebaseUI-Android by firebase.
the class AuthUITest method testEmailBuilder_withSetDefaultEmail_expectSuccess.
@Test
public void testEmailBuilder_withSetDefaultEmail_expectSuccess() {
ActionCodeSettings actionCodeSettings = ActionCodeSettings.newBuilder().setUrl(URL).build();
IdpConfig config = new IdpConfig.EmailBuilder().setDefaultEmail(TestConstants.EMAIL).setActionCodeSettings(actionCodeSettings).build();
assertThat(config.getParams().getString(ExtraConstants.DEFAULT_EMAIL)).isEqualTo(TestConstants.EMAIL);
}
use of com.google.firebase.auth.ActionCodeSettings in project FirebaseUI-Android by firebase.
the class AuthUITest method testEmailBuilder_withActionCodeSettingsAndHandleCodeInAppFalse_expectThrows.
@Test(expected = IllegalStateException.class)
public void testEmailBuilder_withActionCodeSettingsAndHandleCodeInAppFalse_expectThrows() {
ActionCodeSettings actionCodeSettings = ActionCodeSettings.newBuilder().setUrl(URL).build();
new IdpConfig.EmailBuilder().enableEmailLinkSignIn().setActionCodeSettings(actionCodeSettings).build();
}
use of com.google.firebase.auth.ActionCodeSettings in project FirebaseUI-Android by firebase.
the class EmailLinkSendEmailHandler method sendSignInLinkToEmail.
public void sendSignInLinkToEmail(@NonNull final String email, @NonNull final ActionCodeSettings actionCodeSettings, @Nullable final IdpResponse idpResponseForLinking, final boolean forceSameDevice) {
if (getAuth() == null) {
return;
}
setResult(Resource.forLoading());
final String anonymousUserId = AuthOperationManager.getInstance().canUpgradeAnonymous(getAuth(), getArguments()) ? getAuth().getCurrentUser().getUid() : null;
final String sessionId = SessionUtils.generateRandomAlphaNumericString(SESSION_ID_LENGTH);
ActionCodeSettings mutatedSettings = addSessionInfoToActionCodeSettings(actionCodeSettings, sessionId, anonymousUserId, idpResponseForLinking, forceSameDevice);
getAuth().sendSignInLinkToEmail(email, mutatedSettings).addOnCompleteListener(task -> {
if (task.isSuccessful()) {
EmailLinkPersistenceManager.getInstance().saveEmail(getApplication(), email, sessionId, anonymousUserId);
setResult(Resource.forSuccess(email));
} else {
setResult(Resource.forFailure(task.getException()));
}
});
}
use of com.google.firebase.auth.ActionCodeSettings in project FirebaseUI-Android by firebase.
the class EmailActivity method showRegisterEmailLinkFragment.
private void showRegisterEmailLinkFragment(AuthUI.IdpConfig emailConfig, String email) {
ActionCodeSettings actionCodeSettings = emailConfig.getParams().getParcelable(ExtraConstants.ACTION_CODE_SETTINGS);
EmailLinkFragment fragment = EmailLinkFragment.newInstance(email, actionCodeSettings);
switchFragment(fragment, R.id.fragment_register_email, EmailLinkFragment.TAG);
}
Aggregations