public abstract class FirebaseAuth extends Object
The entry point of the Firebase Authentication SDK.
First, obtain an instance of this class by calling getInstance()
.
Then, sign up or sign in a user with one of the following methods:
createUserWithEmailAndPassword(String, String)
signInWithEmailAndPassword(String, String)
signInWithCredential(AuthCredential)
signInAnonymously()
signInWithCustomToken(String)
getCurrentUser()
to get a FirebaseUser
object, which contains information about the signed-in user.
Nested Class Summary
interface | FirebaseAuth.AuthStateListener | Listener called when there is a change in the authentication state. | |
interface | FirebaseAuth.IdTokenListener | Listener called when the id token is changed. |
Public Method Summary
void |
addAuthStateListener(FirebaseAuth.AuthStateListener
listener)
Registers a listener to changes in the user authentication state.
|
void |
addIdTokenListener(FirebaseAuth.IdTokenListener
listener)
Registers a listener to changes in the token authentication state.
|
Task<Void> |
applyActionCode(String code)
Applies the given
code , which can be any out of band code which is
valid according to
checkActionCode(String) that does not also pass
verifyPasswordResetCode(String) , which requires an additional
parameter.
|
Task<ActionCodeResult> | |
Task<Void> |
confirmPasswordReset(String code,
String
newPassword)
Changes the user's password to
newPassword for the account for
which the code is valid.
|
Task<AuthResult> |
createUserWithEmailAndPassword(String email,
String
password)
Tries to create a new user account with the given email address and password.
|
Task<SignInMethodQueryResult> |
fetchSignInMethodsForEmail(String email)
Returns a list of signin methods that can be used to sign in a given user
(identified by its main email address).
|
FirebaseApp |
getApp()
Returns the
FirebaseApp
instance to which this FirebaseAuth
belongs.
|
FirebaseUser |
getCurrentUser()
Returns the currently signed-in
FirebaseUser
or null if there is none.
|
FirebaseAuthSettings |
getFirebaseAuthSettings()
Returns the
FirebaseAuthSettings
instance for this FirebaseAuth
instance.
|
static FirebaseAuth |
getInstance()
Returns an instance of this class corresponding to the default
FirebaseApp
instance.
|
static FirebaseAuth |
getInstance(FirebaseApp
firebaseApp)
Returns an instance of this class corresponding to the given
FirebaseApp
instance.
|
String |
getLanguageCode()
Returns the language code set in
setLanguageCode(String) .
|
Task<AuthResult> |
getPendingAuthResult()
Returns a
Task
wrapping an AuthResult .
|
boolean |
isSignInWithEmailLink(String link)
Determines if the given link is a link intended for use with
getCredentialWithLink(String, String) .
|
void |
removeAuthStateListener(FirebaseAuth.AuthStateListener
listener)
Unregisters a listener to authentication changes.
|
void |
removeIdTokenListener(FirebaseAuth.IdTokenListener
listener)
Unregisters a listener to authentication changes.
|
Task<Void> |
sendPasswordResetEmail(String email,
ActionCodeSettings
actionCodeSettings)
Triggers the Firebase Authentication backend to send a password-reset email to
the given email address, which must correspond to an existing user of your app.
|
Task<Void> |
sendPasswordResetEmail(String email)
Calls
sendPasswordResetEmail(String, ActionCodeSettings) without any
ActionCodeSettings.
|
Task<Void> |
sendSignInLinkToEmail(String email,
ActionCodeSettings
actionCodeSettings)
Sends an email to the specified email which will contain a link to be used to
sign in the user.
|
Task<Void> | |
void |
setLanguageCode(String
languageCode)
Sets the user-facing language code for auth operations that can be
internationalized, such as
sendEmailVerification() .
|
Task<AuthResult> |
signInAnonymously()
Signs in the user anonymously without requiring any credential.
|
Task<AuthResult> |
signInWithCredential(AuthCredential
credential)
Tries to sign in a user with the given
AuthCredential .
|
Task<AuthResult> | |
Task<AuthResult> |