当前位置: 首页>>代码示例>>Java>>正文


Java FacebookAuthProvider.PROVIDER_ID属性代码示例

本文整理汇总了Java中com.google.firebase.auth.FacebookAuthProvider.PROVIDER_ID属性的典型用法代码示例。如果您正苦于以下问题:Java FacebookAuthProvider.PROVIDER_ID属性的具体用法?Java FacebookAuthProvider.PROVIDER_ID怎么用?Java FacebookAuthProvider.PROVIDER_ID使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.google.firebase.auth.FacebookAuthProvider的用法示例。


在下文中一共展示了FacebookAuthProvider.PROVIDER_ID属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doInBackground

@Override
protected Void doInBackground(Void... voids) {
    final FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
    if(user != null) {
        for(UserInfo info : user.getProviderData()) {
            switch(info.getProviderId()) {
                case GoogleAuthProvider.PROVIDER_ID:
                    logoutGoogle();
                    break;
                case FacebookAuthProvider.PROVIDER_ID:
                    logoutFacebook();
                    break;
                case TwitterAuthProvider.PROVIDER_ID:
                    logoutTwitter();
                    break;
            }
        }
        FirebaseAuth.getInstance().signOut();
    }
    return null;
}
 
开发者ID:ultramega,项目名称:flavordex,代码行数:21,代码来源:SettingsActivity.java

示例2: providerIdToAccountType

/**
 * 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 PhoneAuthProvider.PROVIDER_ID:
            return PHONE_IDENTITY;
        // The account type for email/password creds is null
        case EmailAuthProvider.PROVIDER_ID:
        default:
            return null;
    }
}
 
开发者ID:firebase,项目名称:FirebaseUI-Android,代码行数:20,代码来源:ProviderUtils.java

示例3: logoutByProvider

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;
    }
}
 
开发者ID:rozdoum,项目名称:social-app-android,代码行数:11,代码来源:LogoutHelper.java

示例4: getAuthCredential

@Nullable
public static AuthCredential getAuthCredential(IdpResponse response) {
    switch (response.getProviderType()) {
        case GoogleAuthProvider.PROVIDER_ID:
            return GoogleAuthProvider.getCredential(response.getIdpToken(), null);
        case FacebookAuthProvider.PROVIDER_ID:
            return FacebookAuthProvider.getCredential(response.getIdpToken());
        case TwitterAuthProvider.PROVIDER_ID:
            return TwitterAuthProvider.getCredential(response.getIdpToken(),
                    response.getIdpSecret());
        default:
            return null;
    }
}
 
开发者ID:firebase,项目名称:FirebaseUI-Android,代码行数:14,代码来源:ProviderUtils.java

示例5: accountTypeToProviderId

@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 PHONE_IDENTITY:
            return PhoneAuthProvider.PROVIDER_ID;
        default:
            return null;
    }
}
 
开发者ID:firebase,项目名称:FirebaseUI-Android,代码行数:15,代码来源:ProviderUtils.java

示例6: populateProfile

@MainThread
private void populateProfile() {
    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());

    StringBuilder providerList = new StringBuilder(100);

    providerList.append("Providers used: ");

    if (user.getProviders() == null || user.getProviders().isEmpty()) {
        providerList.append("none");
    } else {
        Iterator<String> providerIter = user.getProviders().iterator();
        while (providerIter.hasNext()) {
            String provider = providerIter.next();
            switch (provider) {
                case GoogleAuthProvider.PROVIDER_ID:
                    providerList.append("Google");
                    break;
                case FacebookAuthProvider.PROVIDER_ID:
                    providerList.append("Facebook");
                    break;
                case TwitterAuthProvider.PROVIDER_ID:
                    providerList.append("Twitter");
                    break;
                case EmailAuthProvider.PROVIDER_ID:
                    providerList.append("Email");
                    break;
                case PhoneAuthProvider.PROVIDER_ID:
                    providerList.append("Phone");
                    break;
                default:
                    throw new IllegalStateException("Unknown provider: " + provider);
            }

            if (providerIter.hasNext()) {
                providerList.append(", ");
            }
        }
    }

    mEnabledProviders.setText(providerList);
}
 
开发者ID:firebase,项目名称:FirebaseUI-Android,代码行数:55,代码来源:SignedInActivity.java

示例7: onCreate

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.fui_welcome_back_idp_prompt_layout);

    IdpResponse newUserResponse = IdpResponse.fromResultIntent(getIntent());
    if (newUserResponse != null) {
        mPrevCredential = ProviderUtils.getAuthCredential(newUserResponse);
    }

    User oldUser = User.getUser(getIntent());

    String providerId = oldUser.getProviderId();
    for (IdpConfig idpConfig : getFlowParams().providerInfo) {
        if (providerId.equals(idpConfig.getProviderId())) {
            switch (providerId) {
                case GoogleAuthProvider.PROVIDER_ID:
                    mIdpProvider = new GoogleProvider(this, idpConfig, oldUser.getEmail());
                    break;
                case FacebookAuthProvider.PROVIDER_ID:
                    mIdpProvider = new FacebookProvider(
                            idpConfig, getFlowParams().themeId);
                    break;
                case TwitterAuthProvider.PROVIDER_ID:
                    mIdpProvider = new TwitterProvider(this);
                    break;
                default:
                    Log.w(TAG, "Unknown provider: " + providerId);
                    finish(RESULT_CANCELED,
                           IdpResponse.getErrorCodeIntent(ErrorCodes.UNKNOWN_ERROR));
                    return;
            }
        }
    }

    if (mIdpProvider == null) {
        Log.w(TAG, "Firebase login unsuccessful."
                + " Account linking failed due to provider not enabled by application: "
                + providerId);
        finish(RESULT_CANCELED, IdpResponse.getErrorCodeIntent(ErrorCodes.UNKNOWN_ERROR));
        return;
    }

    ((TextView) findViewById(R.id.welcome_back_idp_prompt))
            .setText(getIdpPromptString(oldUser.getEmail()));

    mIdpProvider.setAuthenticationCallback(this);
    findViewById(R.id.welcome_back_idp_button).setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View view) {
            getDialogHolder().showLoadingDialog(R.string.fui_progress_dialog_signing_in);
            mIdpProvider.startLogin(WelcomeBackIdpPrompt.this);
        }
    });
}
 
开发者ID:firebase,项目名称:FirebaseUI-Android,代码行数:55,代码来源:WelcomeBackIdpPrompt.java


注:本文中的com.google.firebase.auth.FacebookAuthProvider.PROVIDER_ID属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。