OAuthProvider

public class OAuthProvider extends FederatedAuthProvider


Represents the login authentication provider for a generic OAuth2 provider. Use this class to obtain AuthCredentials.

Summary

Nested types

Class used to create instances of OAuthProvider.

Builder class to initialize AuthCredential's.

Public methods

static @NonNull AuthCredential
@InlineMe(replacement = "DefaultOAuthCredential.createDefaultOAuthCredential(providerId, idToken, accessToken)", imports = "com.google.firebase.auth.DefaultOAuthCredential")
getCredential(
    @NonNull String providerId,
    @NonNull String idToken,
    @NonNull String accessToken
)

This method is deprecated.

use newCredentialBuilder instead

@Nullable String

Returns the provider ID with which this OAuthProvider is associated.

static @NonNull OAuthProvider.Builder
newBuilder(@NonNull String providerId)

Returns a OAuthProvider.Builder used to construct a OAuthProvider instantiated with the given providerId.

static @NonNull OAuthProvider.Builder
newBuilder(@NonNull String providerId, @NonNull FirebaseAuth firebaseAuth)

Returns a OAuthProvider.Builder used to construct a OAuthProvider instantiated with the given providerId.

static @NonNull OAuthProvider.CredentialBuilder

Creates an CredentialBuilder for the specified provider ID.

Public methods

getCredential

@InlineMe(replacement = "DefaultOAuthCredential.createDefaultOAuthCredential(providerId, idToken, accessToken)", imports = "com.google.firebase.auth.DefaultOAuthCredential")
public static @NonNull AuthCredential getCredential(
    @NonNull String providerId,
    @NonNull String idToken,
    @NonNull String accessToken
)

Returns a new instance of AuthCredential that wraps a login token. Used when calling signInWithCredential or linkWithCredential.

Parameters
@NonNull String accessToken

a valid Facebook Login access token, obtained from the Facebook Login SDK

getProviderId

public @Nullable String getProviderId()

Returns the provider ID with which this OAuthProvider is associated.

newBuilder

public static @NonNull OAuthProvider.Builder newBuilder(@NonNull String providerId)

Returns a OAuthProvider.Builder used to construct a OAuthProvider instantiated with the given providerId.

newBuilder

public static @NonNull OAuthProvider.Builder newBuilder(@NonNull String providerId, @NonNull FirebaseAuth firebaseAuth)

Returns a OAuthProvider.Builder used to construct a OAuthProvider instantiated with the given providerId. Uses the specified FirebaseAuth instance.

newCredentialBuilder

public static @NonNull OAuthProvider.CredentialBuilder newCredentialBuilder(@NonNull String providerId)

Creates an CredentialBuilder for the specified provider ID.

Throws
java.lang.IllegalArgumentException

if providerId is null or empty