com.google.firebase.auth.ActionCodeSettings Java Examples
The following examples show how to use
com.google.firebase.auth.ActionCodeSettings.
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: FirebaseAuthSnippets.java From firebase-admin-java with Apache License 2.0 | 6 votes |
public void generatePasswordResetLink() { final ActionCodeSettings actionCodeSettings = initActionCodeSettings(); final String displayName = "Example User"; // [START password_reset_link] String email = "[email protected]"; try { String link = FirebaseAuth.getInstance().generatePasswordResetLink( email, actionCodeSettings); // Construct email verification template, embed the link and send // using custom SMTP server. sendCustomPasswordResetEmail(email, displayName, link); } catch (FirebaseAuthException e) { System.out.println("Error generating email link: " + e.getMessage()); } // [END password_reset_link] }
Example #2
Source File: AuthUITest.java From FirebaseUI-Android with Apache License 2.0 | 6 votes |
@Test public void testEmailBuilder_withValidActionCodeSettings_expectSuccess() { ActionCodeSettings actionCodeSettings = ActionCodeSettings.newBuilder() .setUrl(URL) .setHandleCodeInApp(true) .build(); IdpConfig config = new IdpConfig.EmailBuilder() .enableEmailLinkSignIn() .setActionCodeSettings(actionCodeSettings) .setForceSameDevice() .build(); assertThat(config.getParams().getParcelable(ExtraConstants.ACTION_CODE_SETTINGS)) .isEqualTo(actionCodeSettings); assertThat(config.getParams().getBoolean(ExtraConstants.FORCE_SAME_DEVICE)) .isEqualTo(true); assertThat(config.getProviderId()).isEqualTo(AuthUI.EMAIL_LINK_PROVIDER); }
Example #3
Source File: EmailLinkFragment.java From FirebaseUI-Android with Apache License 2.0 | 6 votes |
@Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); initHandler(); String email = getArguments().getString(ExtraConstants.EMAIL); ActionCodeSettings actionCodeSettings = getArguments().getParcelable(ExtraConstants.ACTION_CODE_SETTINGS); IdpResponse idpResponseForLinking = getArguments().getParcelable(ExtraConstants.IDP_RESPONSE); boolean forceSameDevice = getArguments().getBoolean(ExtraConstants.FORCE_SAME_DEVICE); if (!mEmailSent) { mEmailLinkSendEmailHandler.sendSignInLinkToEmail(email, actionCodeSettings, idpResponseForLinking, forceSameDevice); } }
Example #4
Source File: AuthUI.java From FirebaseUI-Android with Apache License 2.0 | 6 votes |
@Override public IdpConfig build() { if (super.mProviderId.equals(EMAIL_LINK_PROVIDER)) { ActionCodeSettings actionCodeSettings = getParams().getParcelable(ExtraConstants.ACTION_CODE_SETTINGS); Preconditions.checkNotNull(actionCodeSettings, "ActionCodeSettings cannot be " + "null when using email link sign in."); if (!actionCodeSettings.canHandleCodeInApp()) { // Pre-emptively fail if actionCodeSettings are misconfigured. This would // have happened when calling sendSignInLinkToEmail throw new IllegalStateException( "You must set canHandleCodeInApp in your ActionCodeSettings to " + "true for Email-Link Sign-in."); } } return super.build(); }
Example #5
Source File: EmailLinkSendEmailHandler.java From FirebaseUI-Android with Apache License 2.0 | 6 votes |
private ActionCodeSettings addSessionInfoToActionCodeSettings(@NonNull ActionCodeSettings actionCodeSettings, @NonNull String sessionId, @NonNull String anonymousUserId, @Nullable IdpResponse response, boolean forceSameDevice) { String continueUrl = actionCodeSettings.getUrl(); ContinueUrlBuilder continueUrlBuilder = new ContinueUrlBuilder(continueUrl); continueUrlBuilder.appendSessionId(sessionId); continueUrlBuilder.appendAnonymousUserId(anonymousUserId); continueUrlBuilder.appendForceSameDeviceBit(forceSameDevice); if (response != null) { continueUrlBuilder.appendProviderId(response.getProviderType()); } return ActionCodeSettings.newBuilder() .setUrl(continueUrlBuilder.build()) .setHandleCodeInApp(true) .setAndroidPackageName(actionCodeSettings.getAndroidPackageName(), actionCodeSettings.getAndroidInstallApp(), actionCodeSettings.getAndroidMinimumVersion()) .setIOSBundleId(actionCodeSettings.getIOSBundle()) .build(); }
Example #6
Source File: MainActivity.java From snippets-android with Apache License 2.0 | 6 votes |
public void buildActionCodeSettings() { // [START auth_build_action_code_settings] ActionCodeSettings actionCodeSettings = ActionCodeSettings.newBuilder() // URL you want to redirect back to. The domain (www.example.com) for this // URL must be whitelisted in the Firebase Console. .setUrl("https://www.example.com/finishSignUp?cartId=1234") // This must be true .setHandleCodeInApp(true) .setIOSBundleId("com.example.ios") .setAndroidPackageName( "com.example.android", true, /* installIfNotAvailable */ "12" /* minimumVersion */) .build(); // [END auth_build_action_code_settings] }
Example #7
Source File: FirebaseAuthSnippets.java From firebase-admin-java with Apache License 2.0 | 6 votes |
public void generateSignInWithEmailLink() { final ActionCodeSettings actionCodeSettings = initActionCodeSettings(); final String displayName = "Example User"; // [START sign_in_with_email_link] String email = "[email protected]"; try { String link = FirebaseAuth.getInstance().generateSignInWithEmailLink( email, actionCodeSettings); // Construct email verification template, embed the link and send // using custom SMTP server. sendCustomPasswordResetEmail(email, displayName, link); } catch (FirebaseAuthException e) { System.out.println("Error generating email link: " + e.getMessage()); } // [END sign_in_with_email_link] }
Example #8
Source File: FirebaseAuthSnippets.java From firebase-admin-java with Apache License 2.0 | 6 votes |
public void generateEmailVerificationLink() { final ActionCodeSettings actionCodeSettings = initActionCodeSettings(); final String displayName = "Example User"; // [START email_verification_link] String email = "[email protected]"; try { String link = FirebaseAuth.getInstance().generateEmailVerificationLink( email, actionCodeSettings); // Construct email verification template, embed the link and send // using custom SMTP server. sendCustomPasswordResetEmail(email, displayName, link); } catch (FirebaseAuthException e) { System.out.println("Error generating email link: " + e.getMessage()); } // [END email_verification_link] }
Example #9
Source File: MainActivity.java From snippets-android with Apache License 2.0 | 5 votes |
public void sendSignInLink(String email, ActionCodeSettings actionCodeSettings) { // [START auth_send_sign_in_link] FirebaseAuth auth = FirebaseAuth.getInstance(); auth.sendSignInLinkToEmail(email, actionCodeSettings) .addOnCompleteListener(new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { if (task.isSuccessful()) { Log.d(TAG, "Email sent."); } } }); // [END auth_send_sign_in_link] }
Example #10
Source File: AuthUITest.java From FirebaseUI-Android with Apache License 2.0 | 5 votes |
@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(); }
Example #11
Source File: AuthUITest.java From FirebaseUI-Android with Apache License 2.0 | 5 votes |
@Test(expected = IllegalStateException.class) public void testEmailBuilder_withActionCodeSettingsAndHandleCodeInAppFalse_expectThrows() { ActionCodeSettings actionCodeSettings = ActionCodeSettings.newBuilder().setUrl(URL).build(); new IdpConfig.EmailBuilder().enableEmailLinkSignIn().setActionCodeSettings (actionCodeSettings).build(); }
Example #12
Source File: FirebaseAuthSnippets.java From firebase-admin-java with Apache License 2.0 | 5 votes |
public ActionCodeSettings initActionCodeSettings() { // [START init_action_code_settings] ActionCodeSettings actionCodeSettings = ActionCodeSettings.builder() .setUrl("https://www.example.com/checkout?cartId=1234") .setHandleCodeInApp(true) .setIosBundleId("com.example.ios") .setAndroidPackageName("com.example.android") .setAndroidInstallApp(true) .setAndroidMinimumVersion("12") .setDynamicLinkDomain("coolapp.page.link") .build(); // [END init_action_code_settings] return actionCodeSettings; }
Example #13
Source File: EmailLinkSendEmailHandlerTest.java From FirebaseUI-Android with Apache License 2.0 | 5 votes |
private void validateSessionIdAddedToContinueUrl(ActionCodeSettings actionCodeSettings, String providerId, boolean forceSameDevice) { EmailLinkParser parser = new EmailLinkParser(actionCodeSettings.getUrl()); assertThat(parser.getSessionId()).isNotNull(); assertThat(parser.getForceSameDeviceBit()).isEqualTo(forceSameDevice); assertThat(parser.getProviderId()).isEqualTo(providerId); }
Example #14
Source File: EmailLinkSendEmailHandlerTest.java From FirebaseUI-Android with Apache License 2.0 | 5 votes |
@Test public void testSendSignInLinkToEmail_linkingFlow_expectSuccess() { mHandler.getOperation().observeForever(mResponseObserver); boolean forceSameDevice = true; ActionCodeSettings actionCodeSettings = ActionCodeSettings.newBuilder().setUrl(URL).build(); when(mMockAuth.sendSignInLinkToEmail(any(String.class), any(ActionCodeSettings.class))) .thenReturn(AutoCompleteTask.<Void>forFailure(new Exception())); IdpResponse idpResponseForLinking = buildFacebookIdpResponseForLinking(); mHandler.sendSignInLinkToEmail(TestConstants.EMAIL, actionCodeSettings, idpResponseForLinking, forceSameDevice); ArgumentCaptor<ActionCodeSettings> acsCaptor = ArgumentCaptor.forClass(ActionCodeSettings.class); verify(mMockAuth).sendSignInLinkToEmail(eq(TestConstants.EMAIL), acsCaptor.capture()); validateSessionIdAddedToContinueUrl(acsCaptor.getValue(), idpResponseForLinking .getProviderType(), forceSameDevice); ArgumentCaptor<Resource<String>> captor = ArgumentCaptor.forClass(Resource.class); InOrder inOrder = inOrder(mResponseObserver); inOrder.verify(mResponseObserver) .onChanged(argThat(ResourceMatchers.<String>isLoading())); inOrder.verify(mResponseObserver).onChanged(captor.capture()); assertThat(captor.getValue().getState()).isEqualTo(State.FAILURE); assertThat(captor.getValue().getException()).isNotNull(); }
Example #15
Source File: EmailLinkSendEmailHandlerTest.java From FirebaseUI-Android with Apache License 2.0 | 5 votes |
@Test @SuppressWarnings("unchecked") public void testSendSignInLinkToEmail_normalFlow_expectFailure() { mHandler.getOperation().observeForever(mResponseObserver); boolean forceSameDevice = true; ActionCodeSettings actionCodeSettings = ActionCodeSettings.newBuilder().setUrl(URL).build(); when(mMockAuth.sendSignInLinkToEmail(any(String.class), any(ActionCodeSettings.class))) .thenReturn(AutoCompleteTask.<Void>forFailure(new Exception())); mHandler.sendSignInLinkToEmail(TestConstants.EMAIL, actionCodeSettings, null, forceSameDevice); ArgumentCaptor<ActionCodeSettings> acsCaptor = ArgumentCaptor.forClass(ActionCodeSettings.class); verify(mMockAuth).sendSignInLinkToEmail(eq(TestConstants.EMAIL), acsCaptor.capture()); assertThat(acsCaptor.getValue()).isNotEqualTo(actionCodeSettings); validateSessionIdAddedToContinueUrl(acsCaptor.getValue(), null, forceSameDevice); ArgumentCaptor<Resource<String>> captor = ArgumentCaptor.forClass(Resource.class); InOrder inOrder = inOrder(mResponseObserver); inOrder.verify(mResponseObserver) .onChanged(argThat(ResourceMatchers.<String>isLoading())); inOrder.verify(mResponseObserver).onChanged(captor.capture()); assertThat(captor.getValue().getState()).isEqualTo(State.FAILURE); assertThat(captor.getValue().getException()).isNotNull(); }
Example #16
Source File: EmailLinkSendEmailHandlerTest.java From FirebaseUI-Android with Apache License 2.0 | 5 votes |
@Test @SuppressWarnings("unchecked") public void testSendSignInLinkToEmail_normalFlow_expectSuccess() { mHandler.getOperation().observeForever(mResponseObserver); boolean forceSameDevice = false; ActionCodeSettings actionCodeSettings = ActionCodeSettings.newBuilder().setUrl(URL).build(); when(mMockAuth.sendSignInLinkToEmail(any(String.class), any(ActionCodeSettings.class))) .thenReturn(AutoCompleteTask.<Void>forSuccess(null)); mHandler.sendSignInLinkToEmail(TestConstants.EMAIL, actionCodeSettings, null, forceSameDevice); ArgumentCaptor<ActionCodeSettings> acsCaptor = ArgumentCaptor.forClass(ActionCodeSettings.class); verify(mMockAuth).sendSignInLinkToEmail(eq(TestConstants.EMAIL), acsCaptor.capture()); assertThat(acsCaptor.getValue()).isNotEqualTo(actionCodeSettings); validateSessionIdAddedToContinueUrl(acsCaptor.getValue(), null, forceSameDevice); String email = mPersistenceManager.retrieveSessionRecord(ApplicationProvider.getApplicationContext()) .getEmail(); assertThat(email).isNotNull(); assertThat(email).isEqualTo(TestConstants.EMAIL); ArgumentCaptor<Resource<String>> captor = ArgumentCaptor.forClass(Resource.class); InOrder inOrder = inOrder(mResponseObserver); inOrder.verify(mResponseObserver) .onChanged(argThat(ResourceMatchers.<String>isLoading())); inOrder.verify(mResponseObserver).onChanged(captor.capture()); assertThat(captor.getValue().getState()).isEqualTo(State.SUCCESS); assertThat(captor.getValue().getValue()).isEqualTo(TestConstants.EMAIL); }
Example #17
Source File: EmailLinkFragment.java From FirebaseUI-Android with Apache License 2.0 | 5 votes |
public static EmailLinkFragment newInstance(@NonNull final String email, @NonNull final ActionCodeSettings actionCodeSettings, @Nullable final IdpResponse idpResponseForLinking, final boolean forceSameDevice) { EmailLinkFragment fragment = new EmailLinkFragment(); Bundle args = new Bundle(); args.putString(ExtraConstants.EMAIL, email); args.putParcelable(ExtraConstants.ACTION_CODE_SETTINGS, actionCodeSettings); args.putParcelable(ExtraConstants.IDP_RESPONSE, idpResponseForLinking); args.putBoolean(ExtraConstants.FORCE_SAME_DEVICE, forceSameDevice); fragment.setArguments(args); return fragment; }
Example #18
Source File: EmailActivity.java From FirebaseUI-Android with Apache License 2.0 | 5 votes |
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); }
Example #19
Source File: MainActivity.java From snippets-android with Apache License 2.0 | 5 votes |
public void sendEmailVerificationWithContinueUrl() { // [START send_email_verification_with_continue_url] FirebaseAuth auth = FirebaseAuth.getInstance(); FirebaseUser user = auth.getCurrentUser(); String url = "http://www.example.com/verify?uid=" + user.getUid(); ActionCodeSettings actionCodeSettings = ActionCodeSettings.newBuilder() .setUrl(url) .setIOSBundleId("com.example.ios") // The default for this is populated with the current android package name. .setAndroidPackageName("com.example.android", false, null) .build(); user.sendEmailVerification(actionCodeSettings) .addOnCompleteListener(new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { if (task.isSuccessful()) { Log.d(TAG, "Email sent."); } } }); // [END send_email_verification_with_continue_url] // [START localize_verification_email] auth.setLanguageCode("fr"); // To apply the default app language instead of explicitly setting it. // auth.useAppLanguage(); // [END localize_verification_email] }
Example #20
Source File: EmailLinkSendEmailHandler.java From FirebaseUI-Android with Apache License 2.0 | 5 votes |
public void sendSignInLinkToEmail(@NonNull final String email, @NonNull final ActionCodeSettings actionCodeSettings, @Nullable final IdpResponse idpResponseForLinking, final boolean forceSameDevice) { if (getAuth() == null) { return; } setResult(Resource.<String>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(new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { if (task.isSuccessful()) { EmailLinkPersistenceManager.getInstance().saveEmail(getApplication(), email, sessionId, anonymousUserId); setResult(Resource.forSuccess(email)); } else { setResult(Resource.<String>forFailure(task.getException())); } } }); }
Example #21
Source File: ConfigurationUtils.java From FirebaseUI-Android with Apache License 2.0 | 5 votes |
@NonNull public static List<AuthUI.IdpConfig> getConfiguredProviders(@NonNull Context context) { List<AuthUI.IdpConfig> providers = new ArrayList<>(); if (!isGoogleMisconfigured(context)) { providers.add(new AuthUI.IdpConfig.GoogleBuilder().build()); } if (!isFacebookMisconfigured(context)) { providers.add(new AuthUI.IdpConfig.FacebookBuilder().build()); } ActionCodeSettings actionCodeSettings = ActionCodeSettings.newBuilder() .setAndroidPackageName("com.firebase.uidemo", true, null) .setHandleCodeInApp(true) .setUrl("https://google.com") .build(); providers.add(new AuthUI.IdpConfig.EmailBuilder() .setAllowNewAccounts(true) .enableEmailLinkSignIn() .setActionCodeSettings(actionCodeSettings) .build()); providers.add(new AuthUI.IdpConfig.TwitterBuilder().build()); providers.add(new AuthUI.IdpConfig.PhoneBuilder().build()); providers.add(new AuthUI.IdpConfig.MicrosoftBuilder().build()); providers.add(new AuthUI.IdpConfig.YahooBuilder().build()); providers.add(new AuthUI.IdpConfig.AppleBuilder().build()); return providers; }
Example #22
Source File: PasswordlessActivity.java From quickstart-android with Apache License 2.0 | 5 votes |
/** * Send an email sign-in link to the specified email. */ private void sendSignInLink(String email) { ActionCodeSettings settings = ActionCodeSettings.newBuilder() .setAndroidPackageName( getPackageName(), false, /* install if not available? */ null /* minimum app version */) .setHandleCodeInApp(true) .setUrl("https://auth.example.com/emailSignInLink") .build(); hideKeyboard(mBinding.fieldEmail); showProgressBar(); mAuth.sendSignInLinkToEmail(email, settings) .addOnCompleteListener(new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { hideProgressBar(); if (task.isSuccessful()) { Log.d(TAG, "Link sent"); showSnackbar("Sign-in link sent!"); mPendingEmail = email; mBinding.status.setText(R.string.status_email_sent); } else { Exception e = task.getException(); Log.w(TAG, "Could not send link", e); showSnackbar("Failed to send link."); if (e instanceof FirebaseAuthInvalidCredentialsException) { mBinding.fieldEmail.setError("Invalid email address."); } } } }); }
Example #23
Source File: EmailLinkFragment.java From FirebaseUI-Android with Apache License 2.0 | 4 votes |
public static EmailLinkFragment newInstance(@NonNull final String email, @NonNull final ActionCodeSettings settings) { return newInstance(email, settings, /*idpResponseForLinking=*/null, false); }
Example #24
Source File: AuthUiActivity.java From FirebaseUI-Android with Apache License 2.0 | 4 votes |
private List<IdpConfig> getSelectedProviders() { List<IdpConfig> selectedProviders = new ArrayList<>(); if (mUseGoogleProvider.isChecked()) { selectedProviders.add( new IdpConfig.GoogleBuilder().setScopes(getGoogleScopes()).build()); } if (mUseFacebookProvider.isChecked()) { selectedProviders.add(new IdpConfig.FacebookBuilder() .setPermissions(getFacebookPermissions()) .build()); } if (mUseEmailProvider.isChecked()) { selectedProviders.add(new IdpConfig.EmailBuilder() .setRequireName(mRequireName.isChecked()) .setAllowNewAccounts(mAllowNewEmailAccounts.isChecked()) .build()); } if (mUseEmailLinkProvider.isChecked()) { ActionCodeSettings actionCodeSettings = ActionCodeSettings.newBuilder() .setAndroidPackageName("com.firebase.uidemo", true, null) .setHandleCodeInApp(true) .setUrl("https://google.com") .build(); selectedProviders.add(new IdpConfig.EmailBuilder() .setAllowNewAccounts(mAllowNewEmailAccounts.isChecked()) .setActionCodeSettings(actionCodeSettings) .enableEmailLinkSignIn() .build()); } if (mUsePhoneProvider.isChecked()) { selectedProviders.add(new IdpConfig.PhoneBuilder().build()); } if (mUseAnonymousProvider.isChecked()) { selectedProviders.add(new IdpConfig.AnonymousBuilder().build()); } if (mUseTwitterProvider.isChecked()) { selectedProviders.add(new IdpConfig.TwitterBuilder().build()); } if (mUseMicrosoftProvider.isChecked()) { selectedProviders.add(new IdpConfig.MicrosoftBuilder().build()); } if (mUseYahooProvider.isChecked()) { selectedProviders.add(new IdpConfig.YahooBuilder().build()); } if (mUseAppleProvider.isChecked()) { selectedProviders.add(new IdpConfig.AppleBuilder().build()); } if (mUseGitHubProvider.isChecked()) { selectedProviders.add(new IdpConfig.GitHubBuilder().build()); } return selectedProviders; }
Example #25
Source File: AuthUITest.java From FirebaseUI-Android with Apache License 2.0 | 4 votes |
@Test(expected = IllegalStateException.class) public void testEmailBuilder_withAnonymousUpgradeAndNotForcingSameDevice_expectThrows() { ActionCodeSettings actionCodeSettings = ActionCodeSettings.newBuilder().setUrl(URL).build(); new IdpConfig.EmailBuilder().enableEmailLinkSignIn().setActionCodeSettings (actionCodeSettings).build(); }
Example #26
Source File: TestHelper.java From FirebaseUI-Android with Apache License 2.0 | 4 votes |
public static FlowParameters getFlowParameters(Collection<String> providerIds, boolean enableAnonymousUpgrade, AuthMethodPickerLayout customLayout) { List<IdpConfig> idpConfigs = new ArrayList<>(); for (String providerId : providerIds) { switch (providerId) { case GoogleAuthProvider.PROVIDER_ID: idpConfigs.add(new IdpConfig.GoogleBuilder().build()); break; case FacebookAuthProvider.PROVIDER_ID: idpConfigs.add(new IdpConfig.FacebookBuilder().build()); break; case TwitterAuthProvider.PROVIDER_ID: idpConfigs.add(new IdpConfig.TwitterBuilder().build()); break; case GithubAuthProvider.PROVIDER_ID: idpConfigs.add(new IdpConfig.GitHubBuilder().build()); break; case EMAIL_LINK_PROVIDER: idpConfigs.add(new IdpConfig.EmailBuilder().enableEmailLinkSignIn() .setActionCodeSettings(ActionCodeSettings.newBuilder().setUrl("URL") .setHandleCodeInApp(true).build()).build()); break; case EmailAuthProvider.PROVIDER_ID: idpConfigs.add(new IdpConfig.EmailBuilder().build()); break; case PhoneAuthProvider.PROVIDER_ID: idpConfigs.add(new IdpConfig.PhoneBuilder().build()); break; case AuthUI.ANONYMOUS_PROVIDER: idpConfigs.add(new IdpConfig.AnonymousBuilder().build()); break; case MICROSOFT_PROVIDER: idpConfigs.add(new IdpConfig.MicrosoftBuilder().build()); break; default: throw new IllegalArgumentException("Unknown provider: " + providerId); } } return new FlowParameters( DEFAULT_APP_NAME, idpConfigs, AuthUI.getDefaultTheme(), AuthUI.NO_LOGO, null, null, true, true, enableAnonymousUpgrade, false, null, customLayout); }
Example #27
Source File: AuthUI.java From FirebaseUI-Android with Apache License 2.0 | 2 votes |
/** * Sets the {@link ActionCodeSettings} object to be used for email link sign in. * <p> * {@link ActionCodeSettings#canHandleCodeInApp()} must be set to true, and a valid * continueUrl must be passed via {@link ActionCodeSettings.Builder#setUrl(String)}. * This URL must be whitelisted in the Firebase Console. * * @throws IllegalStateException if canHandleCodeInApp is set to false * @throws NullPointerException if ActionCodeSettings is null */ @NonNull public EmailBuilder setActionCodeSettings(ActionCodeSettings actionCodeSettings) { getParams().putParcelable(ExtraConstants.ACTION_CODE_SETTINGS, actionCodeSettings); return this; }