The Firebase Authentication service is available for the default app or a given app.
Get the auth instance for the default app:
const authForDefaultApp = firebase.auth();
Get the auth instance for a secondary app:
const otherApp = firebase.app('otherApp'); const authForOtherApp = firebase.auth(otherApp);
TODO @salakar missing updateCurrentUser
FirebaseApp instance for this Firebase service.
Returns the currently signed-in user (or null if no user signed in). See the User interface documentation for detailed usage.
currentUser: User | null;
Applies a verification code sent to the user by email or other out-of-band mechanism.
applyActionCode(code: string): Promise<void>;
Checks a verification code sent to the user by email or other out-of-band mechanism.
Completes the password reset process with the confirmation code and new password, via
confirmPasswordReset(code: string, newPassword: string): Promise<void>;
Creates a new user with an email and password.
Returns a list of authentication methods that can be used to sign in a given user (identified by its main email address).
fetchSignInMethodsForEmail(email: string): Promise<string>;
Returns whether the user signed in with a given email link.
isSignInWithEmailLink(emailLink: string): boolean;
Listen for changes in the users auth state (logging in and out). This method returns a unsubscribe function to stop listening to events. Always ensure you unsubscribe from the listener when no longer needed to prevent updates to components no longer in use.
onAuthStateChanged(listener: AuthListenerCallback): () => void;
Listen for changes in ID token. This method returns a unsubscribe function to stop listening to events. Always ensure you unsubscribe from the listener when no longer needed to prevent updates to components no longer in use.
onIdTokenChanged(listener: AuthListenerCallback): () => void;
Adds a listener to observe changes to the User object. This is a superset of everything from
auth#onIdTokenChanged and user changes. The goal of this
method is to provide easier listening to all user changes, such as when credentials are
linked and unlinked, without manually having to call
onUserChanged(listener: AuthListenerCallback): () => void;
Sends a password reset email to the given email address. Unlike the web SDK, the email will contain a password reset link rather than a code.
Sends a sign in link to the user.
Sign in a user anonymously. If the user has already signed in, that user will be returned.
Signs the user in with a generated credential.
Signs a user in with a custom token.
Signs a user in with an email and password.
Signs the user in with an email link.
Signs in the user using their phone number.
Switch userAccessGroup and current user to the given accessGroup and the user stored in it. Sign in a user with any sign in method, and the same current user is available in all apps in the access group.
useUserAccessGroup(userAccessGroup: string): Promise<null>;
Checks a password reset code sent to the user by email or other out-of-band mechanism. TODO salakar: confirm return behavior (Returns the user's email address if valid.)
verifyPasswordResetCode(code: string): Promise<void>;
Returns a PhoneAuthListener to listen to phone verification events, on the final completion event a PhoneAuthCredential can be generated for authentication purposes.
verifyPhoneNumber(phoneNumber: string, autoVerifyTimeoutOrForceResend?: number | boolean, forceResend?: undefined | false | true): PhoneAuthListener;
Apple auth provider implementation. Currently this is iOS only.
Email and password auth provider implementation.
Facebook auth provider implementation.