OAuthProvider

public classOAuthProvider extendsFederatedAuthProvider


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

Summary

Nested types

Class used to create instances ofOAuthProvider.

Builder class to initializeAuthCredential's.

Public methods

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

This method is deprecated.

usenewCredentialBuilder instead

@NullableString

Returns the provider ID with which this OAuthProvider is associated.

static @NonNullOAuthProvider.Builder

Returns aOAuthProvider.Builder used to construct aOAuthProvider instantiated with the givenproviderId.

static @NonNullOAuthProvider.Builder
newBuilder(@NonNullString providerId, @NonNullFirebaseAuth firebaseAuth)

Returns aOAuthProvider.Builder used to construct aOAuthProvider instantiated with the givenproviderId.

static @NonNullOAuthProvider.CredentialBuilder

Creates anCredentialBuilder for the specified provider ID.

Public methods

getCredential

@InlineMe(replacement = "DefaultOAuthCredential.createDefaultOAuthCredential(providerId, idToken, accessToken)", imports = "com.google.firebase.auth.DefaultOAuthCredential")
public static @NonNullAuthCredential getCredential(
    @NonNullString providerId,
    @NonNullString idToken,
    @NonNullString accessToken
)
This method is deprecated.

usenewCredentialBuilder instead

Returns a new instance ofAuthCredential that wraps a login token. Used when callingsignInWithCredential orlinkWithCredential.

Parameters
@NonNullString accessToken

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

getProviderId

public @NullableString getProviderId()

Returns the provider ID with which this OAuthProvider is associated.

newBuilder

public static @NonNullOAuthProvider.Builder newBuilder(@NonNullString providerId)

Returns aOAuthProvider.Builder used to construct aOAuthProvider instantiated with the givenproviderId.

newBuilder

public static @NonNullOAuthProvider.Builder newBuilder(@NonNullString providerId, @NonNullFirebaseAuth firebaseAuth)

Returns aOAuthProvider.Builder used to construct aOAuthProvider instantiated with the givenproviderId. Uses the specifiedFirebaseAuth instance.

newCredentialBuilder

public static @NonNullOAuthProvider.CredentialBuilder newCredentialBuilder(@NonNullString providerId)

Creates anCredentialBuilder for the specified provider ID.

Throws
java.lang.IllegalArgumentException

ifproviderId is null or empty

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-07-21 UTC.