OAuthProvider

classOAuthProvider :FederatedAuthProvider


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 functions

java-staticAuthCredential
@InlineMe(replacement = "DefaultOAuthCredential.createDefaultOAuthCredential(providerId, idToken, accessToken)", imports = "com.google.firebase.auth.DefaultOAuthCredential")
getCredential(providerId: String, idToken: String, accessToken: String)

This function is deprecated.

usenewCredentialBuilder instead

String?

Returns the provider ID with which this OAuthProvider is associated.

java-staticOAuthProvider.Builder
newBuilder(providerId: String)

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

java-staticOAuthProvider.Builder
newBuilder(providerId: String, firebaseAuth: FirebaseAuth)

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

java-staticOAuthProvider.CredentialBuilder

Creates anCredentialBuilder for the specified provider ID.

Public functions

getCredential

@InlineMe(replacement = "DefaultOAuthCredential.createDefaultOAuthCredential(providerId, idToken, accessToken)", imports = "com.google.firebase.auth.DefaultOAuthCredential")
java-static fun getCredential(providerId: String, idToken: String, accessToken: String): AuthCredential
This function is deprecated.

usenewCredentialBuilder instead

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

Parameters
accessToken: String

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

getProviderId

fun getProviderId(): String?

Returns the provider ID with which this OAuthProvider is associated.

newBuilder

java-static fun newBuilder(providerId: String): OAuthProvider.Builder

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

newBuilder

java-static fun newBuilder(providerId: String, firebaseAuth: FirebaseAuth): OAuthProvider.Builder

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

newCredentialBuilder

java-static fun newCredentialBuilder(providerId: String): OAuthProvider.CredentialBuilder

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.