本文整理汇总了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;
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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);
}
示例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);
}
});
}