/** * Modular Auth API for React Native Firebase. * * Most exports mirror the [firebase-js-sdk modular Auth API](https://firebase.google.com/docs/reference/js/auth). * Remarks on individual symbols call out React Native-specific behavior, unsupported * web-only APIs, and return-type differences. * * @packageDocumentation */ import './types/internal'; export type * from './types/auth'; export { ActionCodeURL } from './ActionCodeURL'; export { AuthCredential, EmailAuthCredential, OAuthCredential, PhoneAuthCredential, } from './credentials'; import { ActionCodeURL } from './ActionCodeURL'; import { PhoneAuthState } from './PhoneAuthState'; import PhoneMultiFactorGenerator from './PhoneMultiFactorGenerator'; import TotpMultiFactorGenerator from './TotpMultiFactorGenerator'; import { TotpSecret } from './TotpSecret'; import AppleAuthProvider from './providers/AppleAuthProvider'; import EmailAuthProvider from './providers/EmailAuthProvider'; import FacebookAuthProvider from './providers/FacebookAuthProvider'; import GithubAuthProvider from './providers/GithubAuthProvider'; import GoogleAuthProvider from './providers/GoogleAuthProvider'; import OAuthProvider from './providers/OAuthProvider'; import OIDCAuthProvider from './providers/OIDCAuthProvider'; import PhoneAuthProvider from './providers/PhoneAuthProvider'; import TwitterAuthProvider from './providers/TwitterAuthProvider'; import { ActionCodeOperation, FactorId, OperationType, ProviderId, SignInMethod } from './constants'; import type { FirebaseApp } from '@react-native-firebase/app'; import type { ActionCodeInfo, ActionCodeSettings, AdditionalUserInfo, ApplicationVerifier, Auth, AuthCredential, AuthProvider, CompleteFn, ConfirmationResult, Dependencies, ErrorFn, IdTokenResult, MultiFactorError, MultiFactorResolver, MultiFactorUser, NextOrObserver, PasswordValidationStatus, Persistence, PhoneAuthCredential, PhoneAuthListener, PopupRedirectResolver, Unsubscribe, User, UserCredential } from './types/auth'; export { AppleAuthProvider, EmailAuthProvider, FacebookAuthProvider, GithubAuthProvider, GoogleAuthProvider, OAuthProvider, OIDCAuthProvider, PhoneAuthProvider, PhoneAuthState, PhoneMultiFactorGenerator, TotpMultiFactorGenerator, TotpSecret, TwitterAuthProvider, ActionCodeOperation, FactorId, OperationType, ProviderId, SignInMethod, }; /** * Returns the Auth instance associated with the provided FirebaseApp. * * @param app - The Firebase app instance. Defaults to the default app. */ export declare function getAuth(app?: FirebaseApp): Auth; /** * This function allows more control over the Auth instance than getAuth(). * * @param app - The Firebase app to initialize Auth for. * @param _deps - Optional firebase-js-sdk dependency bag. * * @remarks * The optional `deps` argument exists for firebase-js-sdk API parity. React Native Firebase * ignores persistence, popup redirect resolver, and error-map dependencies because native * iOS/Android SDKs manage auth state and do not support the web-only persistence stack. * `initializeAuth()` returns the same shared Auth instance as {@link getAuth}. */ export declare function initializeAuth(app: FirebaseApp, _deps?: Dependencies): Auth; /** * Applies an out-of-band email action code (for example from a password reset or email verification link). */ export declare function applyActionCode(auth: Auth, oobCode: string): Promise; /** * Registers a callback to run before an auth state change is committed. * * @returns An unsubscribe function. */ export declare function beforeAuthStateChanged(auth: Auth, callback: (user: User | null) => void | Promise, onAbort?: () => void): Unsubscribe; /** * Checks the validity of an out-of-band email action code and returns metadata about the pending operation. * * @remarks React Native Firebase normalizes native results toward firebase-js-sdk shapes, including mapping * `fromEmail` to `previousEmail` and coercing multi-factor info objects. */ export declare function checkActionCode(auth: Auth, oobCode: string): Promise; /** * Confirms a password reset using the out-of-band code from the reset email. */ export declare function confirmPasswordReset(auth: Auth, oobCode: string, newPassword: string): Promise; /** * Connects the Auth instance to the Auth emulator. * * @remarks Delegates to the native `useEmulator` bridge. Accepts the firebase-js-sdk * `options.disableWarnings` flag for {@link Auth.emulatorConfig} parity. On web, that flag * suppresses the emulator DOM warning banner; native iOS/Android SDKs do not surface that banner, * so the value is recorded on `auth.emulatorConfig.options` only. When `options` is provided, * `disableWarnings` is required (matching firebase-js-sdk). */ export declare function connectAuthEmulator(auth: Auth, url: string, options?: { disableWarnings: boolean; }): void; /** * Creates a new user with an email address and password. * * @remarks Returned {@link UserCredential} objects include top-level `providerId` and `operationType` * fields. `additionalUserInfo`, when present, is attached as a non-enumerable property. */ export declare function createUserWithEmailAndPassword(auth: Auth, email: string, password: string): Promise; /** * Fetches the sign-in methods available for the given email address. */ export declare function fetchSignInMethodsForEmail(auth: Auth, email: string): Promise; /** * Extracts a {@link MultiFactorResolver} from a {@link MultiFactorError}. * * @throws If the error does not contain resolver hints. */ export declare function getMultiFactorResolver(auth: Auth, error: MultiFactorError): MultiFactorResolver; /** * Returns the redirect sign-in result after a browser redirect flow completes. * * @remarks * **Not supported on React Native Firebase.** Always throws synchronously because native provider * flows do not use the browser redirect contract from the firebase-js-sdk. */ export declare function getRedirectResult(_auth: Auth, _resolver?: PopupRedirectResolver): Promise; /** * Checks whether an email link is a valid sign-in with email link URL. * */ export declare function isSignInWithEmailLink(auth: Auth, emailLink: string): boolean; /** * Subscribes to auth state changes for the given Auth instance. * * @returns An unsubscribe function. * * @remarks The legacy `error` and `completed` callback overload exists for firebase-js-sdk API parity. * Native auth listeners never invoke separate error or completed callbacks. */ export declare function onAuthStateChanged(auth: Auth, nextOrObserver: NextOrObserver, _error?: ErrorFn, _completed?: CompleteFn): Unsubscribe; /** * Subscribes to ID token changes for the given Auth instance. * * @returns An unsubscribe function. * * @remarks The legacy `error` and `completed` callback overload exists for firebase-js-sdk API parity. * Native auth listeners never invoke separate error or completed callbacks. */ export declare function onIdTokenChanged(auth: Auth, nextOrObserver: NextOrObserver, _error?: ErrorFn, _completed?: CompleteFn): Unsubscribe; /** * Revokes the given OAuth access token for the current user. * * @remarks * **Web only.** Always throws synchronously on React Native Firebase. */ export declare function revokeAccessToken(_auth: Auth, _token: string): Promise; /** * Revokes a user's Sign in with Apple token. * * @remarks * React Native Firebase-specific API required by Apple's account-deletion guidelines. * **Supported on iOS** via the native `revokeTokenWithAuthorizationCode` bridge. * On Android and Web the bridge resolves without performing revocation (no-op). * Distinct from firebase-js-sdk {@link revokeAccessToken}, which revokes OAuth access tokens on Web only. */ export declare function revokeToken(auth: Auth, authorizationCode: string): Promise; /** * Sends a password reset email to the given address. */ export declare function sendPasswordResetEmail(auth: Auth, email: string, actionCodeSettings?: ActionCodeSettings): Promise; /** * Sends a sign-in with email link to the given address. * * @remarks `actionCodeSettings` is required in the modular API (matching firebase-js-sdk). * The namespaced `firebase.auth().sendSignInLinkToEmail(email, settings?)` API still supplies * defaults when settings are omitted. */ export declare function sendSignInLinkToEmail(auth: Auth, email: string, actionCodeSettings: ActionCodeSettings): Promise; /** * Sets the persistence type for the Auth instance. * * @remarks * **Not supported on React Native Firebase.** Always throws synchronously because auth state is * managed by the native iOS/Android SDKs rather than the web persistence stack. */ export declare function setPersistence(_auth: Auth, _persistence: Persistence): Promise; /** * Signs in anonymously. */ export declare function signInAnonymously(auth: Auth): Promise; /** * Signs in with the given auth credential. */ export declare function signInWithCredential(auth: Auth, credential: AuthCredential): Promise; /** * Signs in with a custom authentication token. */ export declare function signInWithCustomToken(auth: Auth, customToken: string): Promise; /** * Signs in with an email address and password. */ export declare function signInWithEmailAndPassword(auth: Auth, email: string, password: string): Promise; /** * Signs in using an email and sign-in with email link. * * @remarks The `emailLink` argument is optional, matching firebase-js-sdk. */ export declare function signInWithEmailLink(auth: Auth, email: string, emailLink?: string): Promise; /** * Signs in with a phone number and returns a confirmation result for SMS verification. * * @remarks * Native SDKs own the phone verification flow. The optional `appVerifier` argument from the * firebase-js-sdk is ignored. This modular API also does not accept RNFB's legacy `forceResend` * argument — use {@link verifyPhoneNumber} for the native listener / force-resend flow instead. */ export declare function signInWithPhoneNumber(auth: Auth, phoneNumber: string, _appVerifier?: ApplicationVerifier): Promise; /** * Starts native phone number verification and returns a listener for verification events. * * @remarks React Native Firebase-specific API with no firebase-js-sdk equivalent. Use this for * auto-verification, resend, and multi-step phone auth flows that require native callbacks. */ export declare function verifyPhoneNumber(auth: Auth, phoneNumber: string, autoVerifyTimeoutOrForceResend?: number | boolean, forceResend?: boolean): PhoneAuthListener; /** * Signs in with the given provider using a native popup-style flow where supported. */ export declare function signInWithPopup(auth: Auth, provider: AuthProvider, _resolver?: PopupRedirectResolver): Promise; /** * Signs in with the given provider using a redirect-style flow. * * @remarks On React Native Firebase, native provider flows complete immediately and resolve with a * {@link UserCredential} instead of following the browser redirect contract used by the * firebase-js-sdk (which resolves later via {@link getRedirectResult}). */ export declare function signInWithRedirect(auth: Auth, provider: AuthProvider, _resolver?: PopupRedirectResolver): Promise; /** * Signs out the current user for the given Auth instance. */ export declare function signOut(auth: Auth): Promise; /** * Updates the currently signed-in user on the Auth instance. */ export declare function updateCurrentUser(auth: Auth, user: User | null): Promise; /** * Sets the Auth `languageCode` from the device locale. * * @remarks * **Not supported on React Native Firebase.** Always throws synchronously. Set `auth.languageCode` * directly or use {@link setLanguageCode}. */ export declare function useDeviceLanguage(_auth: Auth): void; /** * Sets the Auth language code. * * @remarks React Native Firebase exposes this as a modular helper. The firebase-js-sdk only exposes * the writable `auth.languageCode` property. */ export declare function setLanguageCode(auth: Auth, languageCode: string | null): Promise; /** * Configures iOS keychain access group sharing for the Auth instance. * * @remarks **iOS only** React Native Firebase helper with no firebase-js-sdk equivalent. * Enables sharing auth state across apps in the same access group (e.g. app extensions). */ export declare function useUserAccessGroup(auth: Auth, userAccessGroup: string): Promise; /** * Verifies a password reset code and returns the associated email address. */ export declare function verifyPasswordResetCode(auth: Auth, code: string): Promise; /** * Parses an email action link string. * * @param link - The email action link to parse. * @returns The {@link ActionCodeURL} object, or `null` if the link is invalid. * * @remarks Pure URL parsing (ported from firebase-js-sdk). Works on all platforms without a native * bridge. See also {@link ActionCodeURL.parseLink}. */ export declare function parseActionCodeURL(link: string): ActionCodeURL | null; /** * Deletes the given user account. */ export declare function deleteUser(user: User): Promise; /** * Returns the current ID token for the user. */ export declare function getIdToken(user: User, forceRefresh?: boolean): Promise; /** * Returns the decoded ID token result for the user. */ export declare function getIdTokenResult(user: User, forceRefresh?: boolean): Promise; /** * Links the user account with the given credential. */ export declare function linkWithCredential(user: User, credential: AuthCredential): Promise; /** * Links the user account with a phone number using SMS verification. * * @remarks * **Not supported on React Native Firebase.** Always throws synchronously. */ export declare function linkWithPhoneNumber(_user: User, _phoneNumber: string, _appVerifier?: ApplicationVerifier): Promise; /** * Links the user account with the given provider using a native popup-style flow where supported. */ export declare function linkWithPopup(user: User, provider: AuthProvider, _resolver?: PopupRedirectResolver): Promise; /** * Links the user account with the given provider using a redirect-style flow. * * @remarks On React Native Firebase, native provider flows complete immediately and resolve with a * {@link UserCredential} instead of following the browser redirect contract used by the * firebase-js-sdk. */ export declare function linkWithRedirect(user: User, provider: AuthProvider, _resolver?: PopupRedirectResolver): Promise; /** * Returns the multi-factor interface for the given user. * * @remarks Uses the user's own Auth instance instead of always calling {@link getAuth}, which fixes * secondary Firebase app usage compared with earlier RNFB behavior. */ export declare function multiFactor(user: User): MultiFactorUser; /** * Reauthenticates the user with the given credential. */ export declare function reauthenticateWithCredential(user: User, credential: AuthCredential): Promise; /** * Reauthenticates the user with a phone number using SMS verification. * * @remarks * **Not supported on React Native Firebase.** Always throws synchronously. */ export declare function reauthenticateWithPhoneNumber(_user: User, _phoneNumber: string, _appVerifier?: ApplicationVerifier): Promise; /** * Reauthenticates the user with the given provider using a native popup-style flow where supported. */ export declare function reauthenticateWithPopup(user: User, provider: AuthProvider, _resolver?: PopupRedirectResolver): Promise; /** * Reauthenticates the user with the given provider using a redirect-style flow. * * @remarks On React Native Firebase, native provider flows do not follow the browser redirect * contract. This resolves with `void` after the native flow completes instead of the * firebase-js-sdk `Promise` signature used for unresolved browser redirects. */ export declare function reauthenticateWithRedirect(user: User, provider: AuthProvider, _resolver?: PopupRedirectResolver): Promise; /** * Reloads the user's profile data from the server. */ export declare function reload(user: User): Promise; /** * Sends an email verification message to the user. */ export declare function sendEmailVerification(user: User, actionCodeSettings?: ActionCodeSettings | null): Promise; /** * Unlinks a provider from the user account. */ export declare function unlink(user: User, providerId: string): Promise; /** * Updates the user's email address. */ export declare function updateEmail(user: User, newEmail: string): Promise; /** * Updates the user's password. */ export declare function updatePassword(user: User, newPassword: string): Promise; /** * Updates the user's phone number using a phone auth credential. */ export declare function updatePhoneNumber(user: User, credential: PhoneAuthCredential): Promise; /** * Updates the user's display name and/or photo URL. */ export declare function updateProfile(user: User, profile: { displayName?: string | null; photoURL?: string | null; }): Promise; /** * Sends a verification email to the new address before updating the user's email. */ export declare function verifyBeforeUpdateEmail(user: User, newEmail: string, actionCodeSettings?: ActionCodeSettings | null): Promise; /** * Returns additional OAuth / federated sign-in information from a {@link UserCredential}. * * @remarks Returns firebase-js-sdk core fields plus any extra native keys copied from the bridge. */ export declare function getAdditionalUserInfo(userCredential: UserCredential): AdditionalUserInfo | null; /** * Returns the configured custom auth domain for the Auth instance. * * @remarks React Native Firebase-specific helper with no firebase-js-sdk modular equivalent. * Reads the custom domain configured for the Firebase project through the native Auth SDK. */ export declare function getCustomAuthDomain(auth: Auth): Promise; /** * Validates a password against the project's password policy. */ export declare function validatePassword(auth: Auth, password: string): Promise; export declare const SDK_VERSION: string; //# sourceMappingURL=index.d.ts.map