Auth class
The Firebase Auth service class.
See: firebase.google.com/docs/reference/js/firebase.auth.Auth.
Properties
- app → App
-
App for this instance of auth service.
no setter
- currentUser → User?
-
Currently signed-in User.
no setter
-
currentUserAsync
→ FutureOr<
User> -
If currentUser is not null, returns currentUser, otherwise returns
Future<User>
that will complete with the nextUser
after sign-in succeeds.no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- jsObject → AuthJsImpl
-
JS object.
finalinherited
- languageCode ↔ String
-
The current Auth instance's language code.
When set to
null
, the default Firebase Console language setting is applied. The language code will propagate to email action templates (password reset, email verification and email change revocation), SMS templates for phone authentication, reCAPTCHA verifier and OAuth popup/redirect operations provided the specified providers support localization with the language code specified.getter/setter pair -
onAuthStateChanged
→ Stream<
User?> -
Sends events when the users sign-in state changes.
no setter
-
onIdTokenChanged
→ Stream<
User?> -
Sends events for changes to the signed-in user's ID token,
which includes sign-in, sign-out, and token refresh events.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
applyActionCode(
String code) → Future -
Applies a verification
code
sent to the user by e-mail or by other out-of-band mechanism. -
checkActionCode(
String code) → Future< ActionCodeInfo> -
Checks a verification
code
sent to the user by e-mail or by other out-of-band mechanism. It returnsActionCodeInfo
, metadata about the code. -
confirmPasswordReset(
String code, String newPassword) → Future -
Completes password reset process with a
code
and anewPassword
. -
createUserWithEmailAndPassword(
String email, String password) → Future< UserCredential> - Creates a new user account associated with the specified email address and password.
-
fetchSignInMethodsForEmail(
String email) → Future< List< String> > - Gets the list of possible sign in methods for the given email address.
-
getRedirectResult(
) → Future< UserCredential> -
Returns a
UserCredential
from the redirect-based sign in flow. If sign is successful, returns the signed in user. Or fails with an error if sign is unsuccessful. TheUserCredential
with a null User is returned if no redirect operation was called. -
isSignInWithEmailLink(
String emailLink) → bool - Checks if an incoming link is a sign-in with email link.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
sendPasswordResetEmail(
String email, [ActionCodeSettings? actionCodeSettings]) → Future -
Sends a password reset e-mail to the given
email
. To confirm password reset, use the Auth.confirmPasswordReset. -
sendSignInLinkToEmail(
String email, [ActionCodeSettings? actionCodeSettings]) → Future - Sends a sign-in email link to the user with the specified email.
-
setPersistence(
String persistence) → Future - Changes the current type of persistence on the current Auth instance for the currently saved Auth session and applies this type of persistence for future sign-in requests, including sign-in with redirect requests. This will return a Future that will resolve once the state finishes copying from one type of storage to the other. Calling a sign-in method after changing persistence will wait for that persistence change to complete before applying it on the new Auth state.
-
signInAndRetrieveDataWithCustomToken(
String token) → Future< UserCredential> -
Signs in a user asynchronously using a custom
token
and returns any additional user info data or credentials. -
signInAnonymously(
) → Future< UserCredential> - Asynchronously signs in as an anonymous user.
-
signInWithCredential(
AuthCredential credential) → Future< UserCredential> - Asynchronously signs in with the given credentials, and returns any available additional user information, such as user name.
-
signInWithCustomToken(
String token) → Future< UserCredential> - Asynchronously signs in using a custom token.
-
signInWithEmailAndPassword(
String email, String password) → Future< UserCredential> - Asynchronously signs in using an email and password.
-
signInWithEmailLink(
String email, String emailLink) → Future< UserCredential> -
Signs in using
email
andemailLink
link. -
signInWithPhoneNumber(
String phoneNumber, ApplicationVerifier< ApplicationVerifierJsImpl> applicationVerifier) → Future<ConfirmationResult> - Asynchronously signs in using a phone number in E.164 format (e.g. +16505550101).
-
signInWithPopup(
AuthProvider< AuthProviderJsImpl> provider) → Future<UserCredential> -
Signs in using a popup-based OAuth authentication flow with the
given
provider
. ReturnsUserCredential
if successful, or an error object if unsuccessful. -
signInWithRedirect(
AuthProvider< AuthProviderJsImpl> provider) → Future -
Signs in using a full-page redirect flow with the given
provider
. -
signOut(
) → Future - Signs out the current user.
-
toString(
) → String -
A string representation of this object.
inherited
-
useDeviceLanguage(
) → void - Sets the current language to the default device/browser preference.
-
verifyPasswordResetCode(
String code) → Future< String> -
Verifies a password reset
code
sent to the user by email or other out-of-band mechanism. Returns the user's e-mail address if valid.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
getInstance(
AuthJsImpl jsObject) → Auth -
Creates a new Auth from a
jsObject
.