Java Code Examples for com.google.firebase.auth.FacebookAuthProvider#PROVIDER_ID
The following examples show how to use
com.google.firebase.auth.FacebookAuthProvider#PROVIDER_ID .
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: AuthUI.java From FirebaseUI-Android with Apache License 2.0 | 6 votes |
public FacebookBuilder() { super(FacebookAuthProvider.PROVIDER_ID); if (!ProviderAvailability.IS_FACEBOOK_AVAILABLE) { throw new RuntimeException( "Facebook provider cannot be configured " + "without dependency. Did you forget to add " + "'com.facebook.android:facebook-login:VERSION' dependency?"); } Preconditions.checkConfigured(getApplicationContext(), "Facebook provider unconfigured. Make sure to add a" + " `facebook_application_id` string. See the docs for more info:" + " https://github" + ".com/firebase/FirebaseUI-Android/blob/master/auth/README" + ".md#facebook", R.string.facebook_application_id); if (getApplicationContext().getString(R.string.facebook_login_protocol_scheme) .equals("fbYOUR_APP_ID")) { Log.w(TAG, "Facebook provider unconfigured for Chrome Custom Tabs."); } }
Example 2
Source File: ProviderUtils.java From FirebaseUI-Android with Apache License 2.0 | 6 votes |
@NonNull @AuthUI.SupportedProvider public static String signInMethodToProviderId(@NonNull String method) { switch (method) { case GoogleAuthProvider.GOOGLE_SIGN_IN_METHOD: return GoogleAuthProvider.PROVIDER_ID; case FacebookAuthProvider.FACEBOOK_SIGN_IN_METHOD: return FacebookAuthProvider.PROVIDER_ID; case TwitterAuthProvider.TWITTER_SIGN_IN_METHOD: return TwitterAuthProvider.PROVIDER_ID; case GithubAuthProvider.GITHUB_SIGN_IN_METHOD: return GithubAuthProvider.PROVIDER_ID; case PhoneAuthProvider.PHONE_SIGN_IN_METHOD: return PhoneAuthProvider.PROVIDER_ID; case EmailAuthProvider.EMAIL_PASSWORD_SIGN_IN_METHOD: return EmailAuthProvider.PROVIDER_ID; case EmailAuthProvider.EMAIL_LINK_SIGN_IN_METHOD: return EMAIL_LINK_PROVIDER; default: return method; } }
Example 3
Source File: ProviderUtils.java From FirebaseUI-Android with Apache License 2.0 | 6 votes |
/** * Translate a Firebase Auth provider ID (such as {@link GoogleAuthProvider#PROVIDER_ID}) to a * Credentials API account type (such as {@link IdentityProviders#GOOGLE}). */ public static String providerIdToAccountType( @AuthUI.SupportedProvider @NonNull String providerId) { switch (providerId) { case GoogleAuthProvider.PROVIDER_ID: return IdentityProviders.GOOGLE; case FacebookAuthProvider.PROVIDER_ID: return IdentityProviders.FACEBOOK; case TwitterAuthProvider.PROVIDER_ID: return IdentityProviders.TWITTER; case GithubAuthProvider.PROVIDER_ID: return GITHUB_IDENTITY; case PhoneAuthProvider.PROVIDER_ID: return PHONE_IDENTITY; // The account type for email/password creds is null case EmailAuthProvider.PROVIDER_ID: default: return null; } }
Example 4
Source File: ProviderUtils.java From FirebaseUI-Android with Apache License 2.0 | 6 votes |
@AuthUI.SupportedProvider public static String accountTypeToProviderId(@NonNull String accountType) { switch (accountType) { case IdentityProviders.GOOGLE: return GoogleAuthProvider.PROVIDER_ID; case IdentityProviders.FACEBOOK: return FacebookAuthProvider.PROVIDER_ID; case IdentityProviders.TWITTER: return TwitterAuthProvider.PROVIDER_ID; case GITHUB_IDENTITY: return GithubAuthProvider.PROVIDER_ID; case PHONE_IDENTITY: return PhoneAuthProvider.PROVIDER_ID; default: return null; } }
Example 5
Source File: ProviderUtils.java From FirebaseUI-Android with Apache License 2.0 | 6 votes |
public static String providerIdToProviderName(@NonNull String providerId) { switch (providerId) { case GoogleAuthProvider.PROVIDER_ID: return AuthUI.getApplicationContext().getString(R.string.fui_idp_name_google); case FacebookAuthProvider.PROVIDER_ID: return AuthUI.getApplicationContext().getString(R.string.fui_idp_name_facebook); case TwitterAuthProvider.PROVIDER_ID: return AuthUI.getApplicationContext().getString(R.string.fui_idp_name_twitter); case GithubAuthProvider.PROVIDER_ID: return AuthUI.getApplicationContext().getString(R.string.fui_idp_name_github); case PhoneAuthProvider.PROVIDER_ID: return AuthUI.getApplicationContext().getString(R.string.fui_idp_name_phone); case EmailAuthProvider.PROVIDER_ID: case EMAIL_LINK_PROVIDER: return AuthUI.getApplicationContext().getString(R.string.fui_idp_name_email); default: return null; } }
Example 6
Source File: LogoutHelper.java From social-app-android with Apache License 2.0 | 5 votes |
private static void logoutByProvider(String providerId, GoogleApiClient mGoogleApiClient, FragmentActivity fragmentActivity) { switch (providerId) { case GoogleAuthProvider.PROVIDER_ID: logoutGoogle(mGoogleApiClient, fragmentActivity); break; case FacebookAuthProvider.PROVIDER_ID: logoutFacebook(fragmentActivity.getApplicationContext()); break; } }
Example 7
Source File: LogoutHelper.java From social-app-android with Apache License 2.0 | 5 votes |
private static void logoutByProvider(String providerId, GoogleApiClient mGoogleApiClient, FragmentActivity fragmentActivity) { switch (providerId) { case GoogleAuthProvider.PROVIDER_ID: logoutGoogle(mGoogleApiClient, fragmentActivity); break; case FacebookAuthProvider.PROVIDER_ID: logoutFacebook(fragmentActivity.getApplicationContext()); break; } }
Example 8
Source File: SignedInActivity.java From FirebaseUI-Android with Apache License 2.0 | 5 votes |
private void populateProfile(@Nullable IdpResponse response) { FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser(); if (user.getPhotoUrl() != null) { GlideApp.with(this) .load(user.getPhotoUrl()) .fitCenter() .into(mUserProfilePicture); } mUserEmail.setText( TextUtils.isEmpty(user.getEmail()) ? "No email" : user.getEmail()); mUserPhoneNumber.setText( TextUtils.isEmpty(user.getPhoneNumber()) ? "No phone number" : user.getPhoneNumber()); mUserDisplayName.setText( TextUtils.isEmpty(user.getDisplayName()) ? "No display name" : user.getDisplayName()); if (response == null) { mIsNewUser.setVisibility(View.GONE); } else { mIsNewUser.setVisibility(View.VISIBLE); mIsNewUser.setText(response.isNewUser() ? "New user" : "Existing user"); } List<String> providers = new ArrayList<>(); if (user.getProviderData().isEmpty()) { providers.add(getString(R.string.providers_anonymous)); } else { for (UserInfo info : user.getProviderData()) { switch (info.getProviderId()) { case GoogleAuthProvider.PROVIDER_ID: providers.add(getString(R.string.providers_google)); break; case FacebookAuthProvider.PROVIDER_ID: providers.add(getString(R.string.providers_facebook)); break; case TwitterAuthProvider.PROVIDER_ID: providers.add(getString(R.string.providers_twitter)); break; case EmailAuthProvider.PROVIDER_ID: providers.add(getString(R.string.providers_email)); break; case PhoneAuthProvider.PROVIDER_ID: providers.add(getString(R.string.providers_phone)); break; case EMAIL_LINK_PROVIDER: providers.add(getString(R.string.providers_email_link)); break; case FirebaseAuthProvider.PROVIDER_ID: // Ignore this provider, it's not very meaningful break; default: providers.add(info.getProviderId()); } } } mEnabledProviders.setText(getString(R.string.used_providers, providers)); }
Example 9
Source File: AuthMethodPickerActivity.java From FirebaseUI-Android with Apache License 2.0 | 5 votes |
private void populateIdpList(List<IdpConfig> providerConfigs) { ViewModelProvider supplier = ViewModelProviders.of(this); mProviders = new ArrayList<>(); for (IdpConfig idpConfig : providerConfigs) { @LayoutRes int buttonLayout; final String providerId = idpConfig.getProviderId(); switch (providerId) { case GoogleAuthProvider.PROVIDER_ID: buttonLayout = R.layout.fui_idp_button_google; break; case FacebookAuthProvider.PROVIDER_ID: buttonLayout = R.layout.fui_idp_button_facebook; break; case EMAIL_LINK_PROVIDER: case EmailAuthProvider.PROVIDER_ID: buttonLayout = R.layout.fui_provider_button_email; break; case PhoneAuthProvider.PROVIDER_ID: buttonLayout = R.layout.fui_provider_button_phone; break; case AuthUI.ANONYMOUS_PROVIDER: buttonLayout = R.layout.fui_provider_button_anonymous; break; default: if (!TextUtils.isEmpty( idpConfig.getParams().getString(GENERIC_OAUTH_PROVIDER_ID))) { buttonLayout = idpConfig.getParams().getInt(GENERIC_OAUTH_BUTTON_ID); break; } throw new IllegalStateException("Unknown provider: " + providerId); } View loginButton = getLayoutInflater().inflate(buttonLayout, mProviderHolder, false); handleSignInOperation(idpConfig, loginButton); mProviderHolder.addView(loginButton); } }
Example 10
Source File: ProviderUtils.java From FirebaseUI-Android with Apache License 2.0 | 5 votes |
@Nullable public static AuthCredential getAuthCredential(IdpResponse response) { if (response.hasCredentialForLinking()) { return response.getCredentialForLinking(); } switch (response.getProviderType()) { case GoogleAuthProvider.PROVIDER_ID: return GoogleAuthProvider.getCredential(response.getIdpToken(), null); case FacebookAuthProvider.PROVIDER_ID: return FacebookAuthProvider.getCredential(response.getIdpToken()); default: return null; } }
Example 11
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); }