12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557 |
- /**
- * Firebase Authentication
- *
- * @packageDocumentation
- */
-
- import { CompleteFn } from '@firebase/util';
- import { ErrorFactory } from '@firebase/util';
- import { ErrorFn } from '@firebase/util';
- import { FirebaseApp } from '@firebase/app';
- import { FirebaseError } from '@firebase/util';
- import { NextFn } from '@firebase/util';
- import { Observer } from '@firebase/util';
- import { Unsubscribe } from '@firebase/util';
-
- /**
- * A response from {@link checkActionCode}.
- *
- * @public
- */
- export declare interface ActionCodeInfo {
- /**
- * The data associated with the action code.
- *
- * @remarks
- * For the {@link ActionCodeOperation}.PASSWORD_RESET, {@link ActionCodeOperation}.VERIFY_EMAIL, and
- * {@link ActionCodeOperation}.RECOVER_EMAIL actions, this object contains an email field with the address
- * the email was sent to.
- *
- * For the {@link ActionCodeOperation}.RECOVER_EMAIL action, which allows a user to undo an email address
- * change, this object also contains a `previousEmail` field with the user account's current
- * email address. After the action completes, the user's email address will revert to the value
- * in the `email` field from the value in `previousEmail` field.
- *
- * For the {@link ActionCodeOperation}.VERIFY_AND_CHANGE_EMAIL action, which allows a user to verify the
- * email before updating it, this object contains a `previousEmail` field with the user account's
- * email address before updating. After the action completes, the user's email address will be
- * updated to the value in the `email` field from the value in `previousEmail` field.
- *
- * For the {@link ActionCodeOperation}.REVERT_SECOND_FACTOR_ADDITION action, which allows a user to
- * unenroll a newly added second factor, this object contains a `multiFactorInfo` field with
- * the information about the second factor. For phone second factor, the `multiFactorInfo`
- * is a {@link MultiFactorInfo} object, which contains the phone number.
- */
- data: {
- email?: string | null;
- multiFactorInfo?: MultiFactorInfo | null;
- previousEmail?: string | null;
- };
- /**
- * The type of operation that generated the action code.
- */
- operation: typeof ActionCodeOperation[keyof typeof ActionCodeOperation];
- }
-
- /**
- * An enumeration of the possible email action types.
- *
- * @public
- */
- export declare const ActionCodeOperation: {
- /** The email link sign-in action. */
- readonly EMAIL_SIGNIN: "EMAIL_SIGNIN";
- /** The password reset action. */
- readonly PASSWORD_RESET: "PASSWORD_RESET";
- /** The email revocation action. */
- readonly RECOVER_EMAIL: "RECOVER_EMAIL";
- /** The revert second factor addition email action. */
- readonly REVERT_SECOND_FACTOR_ADDITION: "REVERT_SECOND_FACTOR_ADDITION";
- /** The revert second factor addition email action. */
- readonly VERIFY_AND_CHANGE_EMAIL: "VERIFY_AND_CHANGE_EMAIL";
- /** The email verification action. */
- readonly VERIFY_EMAIL: "VERIFY_EMAIL";
- };
-
- /**
- * An interface that defines the required continue/state URL with optional Android and iOS
- * bundle identifiers.
- *
- * @public
- */
- export declare interface ActionCodeSettings {
- /**
- * Sets the Android package name.
- *
- * @remarks
- * This will try to open the link in an android app if it is
- * installed. If `installApp` is passed, it specifies whether to install the Android app if the
- * device supports it and the app is not already installed. If this field is provided without
- * a `packageName`, an error is thrown explaining that the `packageName` must be provided in
- * conjunction with this field. If `minimumVersion` is specified, and an older version of the
- * app is installed, the user is taken to the Play Store to upgrade the app.
- */
- android?: {
- installApp?: boolean;
- minimumVersion?: string;
- packageName: string;
- };
- /**
- * When set to true, the action code link will be be sent as a Universal Link or Android App
- * Link and will be opened by the app if installed.
- *
- * @remarks
- * In the false case, the code will be sent to the web widget first and then on continue will
- * redirect to the app if installed.
- *
- * @defaultValue false
- */
- handleCodeInApp?: boolean;
- /**
- * Sets the iOS bundle ID.
- *
- * @remarks
- * This will try to open the link in an iOS app if it is installed.
- *
- * App installation is not supported for iOS.
- */
- iOS?: {
- bundleId: string;
- };
- /**
- * Sets the link continue/state URL.
- *
- * @remarks
- * This has different meanings in different contexts:
- * - When the link is handled in the web action widgets, this is the deep link in the
- * `continueUrl` query parameter.
- * - When the link is handled in the app directly, this is the `continueUrl` query parameter in
- * the deep link of the Dynamic Link.
- */
- url: string;
- /**
- * When multiple custom dynamic link domains are defined for a project, specify which one to use
- * when the link is to be opened via a specified mobile app (for example, `example.page.link`).
- *
- *
- * @defaultValue The first domain is automatically selected.
- */
- dynamicLinkDomain?: string;
- }
-
- /**
- * @license
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /**
- * A utility class to parse email action URLs such as password reset, email verification,
- * email link sign in, etc.
- *
- * @public
- */
- export declare class ActionCodeURL {
- /**
- * The API key of the email action link.
- */
- readonly apiKey: string;
- /**
- * The action code of the email action link.
- */
- readonly code: string;
- /**
- * The continue URL of the email action link. Null if not provided.
- */
- readonly continueUrl: string | null;
- /**
- * The language code of the email action link. Null if not provided.
- */
- readonly languageCode: string | null;
- /**
- * The action performed by the email action link. It returns from one of the types from
- * {@link ActionCodeInfo}
- */
- readonly operation: string;
- /**
- * The tenant ID of the email action link. Null if the email action is from the parent project.
- */
- readonly tenantId: string | null;
- /* Excluded from this release type: __constructor */
- /**
- * Parses the email action link string and returns an {@link ActionCodeURL} if the link is valid,
- * otherwise returns null.
- *
- * @param link - The email action link string.
- * @returns The {@link ActionCodeURL} object, or null if the link is invalid.
- *
- * @public
- */
- static parseLink(link: string): ActionCodeURL | null;
- }
-
- /**
- * A structure containing additional user information from a federated identity provider.
- *
- * @public
- */
- export declare interface AdditionalUserInfo {
- /**
- * Whether the user is new (created via sign-up) or existing (authenticated using sign-in).
- */
- readonly isNewUser: boolean;
- /**
- * Map containing IDP-specific user data.
- */
- readonly profile: Record<string, unknown> | null;
- /**
- * Identifier for the provider used to authenticate this user.
- */
- readonly providerId: string | null;
- /**
- * The username if the provider is GitHub or Twitter.
- */
- readonly username?: string | null;
- }
-
- declare interface APIUserInfo {
- localId?: string;
- displayName?: string;
- photoUrl?: string;
- email?: string;
- emailVerified?: boolean;
- phoneNumber?: string;
- lastLoginAt?: number;
- createdAt?: number;
- tenantId?: string;
- passwordHash?: string;
- providerUserInfo?: ProviderUserInfo[];
- mfaInfo?: MfaEnrollment[];
- }
-
- /**
- * A verifier for domain verification and abuse prevention.
- *
- * @remarks
- * Currently, the only implementation is {@link RecaptchaVerifier}.
- *
- * @public
- */
- export declare interface ApplicationVerifier {
- /**
- * Identifies the type of application verifier (e.g. "recaptcha").
- */
- readonly type: string;
- /**
- * Executes the verification process.
- *
- * @returns A Promise for a token that can be used to assert the validity of a request.
- */
- verify(): Promise<string>;
- }
-
- declare interface ApplicationVerifierInternal extends ApplicationVerifier {
- /* Excluded from this release type: _reset */
- }
-
- /**
- * Applies a verification code sent to the user by email or other out-of-band mechanism.
- *
- * @param auth - The {@link Auth} instance.
- * @param oobCode - A verification code sent to the user.
- *
- * @public
- */
- export declare function applyActionCode(auth: Auth, oobCode: string): Promise<void>;
-
- declare type AppName = string;
-
- /**
- * Interface representing Firebase Auth service.
- *
- * @remarks
- * See {@link https://firebase.google.com/docs/auth/ | Firebase Authentication} for a full guide
- * on how to use the Firebase Auth service.
- *
- * @public
- */
- export declare interface Auth {
- /** The {@link @firebase/app#FirebaseApp} associated with the `Auth` service instance. */
- readonly app: FirebaseApp;
- /** The name of the app associated with the `Auth` service instance. */
- readonly name: string;
- /** The {@link Config} used to initialize this instance. */
- readonly config: Config;
- /**
- * Changes the type of persistence on the `Auth` instance.
- *
- * @remarks
- * This will affect the currently saved Auth session and applies this type of persistence for
- * future sign-in requests, including sign-in with redirect requests.
- *
- * This makes it easy for a user signing in to specify whether their session should be
- * remembered or not. It also makes it easier to never persist the Auth state for applications
- * that are shared by other users or have sensitive data.
- *
- * @example
- * ```javascript
- * auth.setPersistence(browserSessionPersistence);
- * ```
- *
- * @param persistence - The {@link Persistence} to use.
- */
- setPersistence(persistence: Persistence): Promise<void>;
- /**
- * The {@link Auth} instance's language code.
- *
- * @remarks
- * This is a readable/writable property. 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.
- */
- languageCode: string | null;
- /**
- * The {@link Auth} instance's tenant ID.
- *
- * @remarks
- * This is a readable/writable property. When you set the tenant ID of an {@link Auth} instance, all
- * future sign-in/sign-up operations will pass this tenant ID and sign in or sign up users to
- * the specified tenant project. When set to null, users are signed in to the parent project.
- *
- * @example
- * ```javascript
- * // Set the tenant ID on Auth instance.
- * auth.tenantId = 'TENANT_PROJECT_ID';
- *
- * // All future sign-in request now include tenant ID.
- * const result = await signInWithEmailAndPassword(auth, email, password);
- * // result.user.tenantId should be 'TENANT_PROJECT_ID'.
- * ```
- *
- * @defaultValue null
- */
- tenantId: string | null;
- /**
- * The {@link Auth} instance's settings.
- *
- * @remarks
- * This is used to edit/read configuration related options such as app verification mode for
- * phone authentication.
- */
- readonly settings: AuthSettings;
- /**
- * Adds an observer for changes to the user's sign-in state.
- *
- * @remarks
- * To keep the old behavior, see {@link Auth.onIdTokenChanged}.
- *
- * @param nextOrObserver - callback triggered on change.
- * @param error - Deprecated. This callback is never triggered. Errors
- * on signing in/out can be caught in promises returned from
- * sign-in/sign-out functions.
- * @param completed - Deprecated. This callback is never triggered.
- */
- onAuthStateChanged(nextOrObserver: NextOrObserver<User | null>, error?: ErrorFn, completed?: CompleteFn): Unsubscribe;
- /**
- * Adds a blocking callback that runs before an auth state change
- * sets a new user.
- *
- * @param callback - callback triggered before new user value is set.
- * If this throws, it blocks the user from being set.
- * @param onAbort - callback triggered if a later `beforeAuthStateChanged()`
- * callback throws, allowing you to undo any side effects.
- */
- beforeAuthStateChanged(callback: (user: User | null) => void | Promise<void>, onAbort?: () => void): Unsubscribe;
- /**
- * Adds an observer for changes to the signed-in user's ID token.
- *
- * @remarks
- * This includes sign-in, sign-out, and token refresh events.
- *
- * @param nextOrObserver - callback triggered on change.
- * @param error - Deprecated. This callback is never triggered. Errors
- * on signing in/out can be caught in promises returned from
- * sign-in/sign-out functions.
- * @param completed - Deprecated. This callback is never triggered.
- */
- onIdTokenChanged(nextOrObserver: NextOrObserver<User | null>, error?: ErrorFn, completed?: CompleteFn): Unsubscribe;
- /** The currently signed-in user (or null). */
- readonly currentUser: User | null;
- /** The current emulator configuration (or null). */
- readonly emulatorConfig: EmulatorConfig | null;
- /**
- * Asynchronously sets the provided user as {@link Auth.currentUser} on the {@link Auth} instance.
- *
- * @remarks
- * A new instance copy of the user provided will be made and set as currentUser.
- *
- * This will trigger {@link Auth.onAuthStateChanged} and {@link Auth.onIdTokenChanged} listeners
- * like other sign in methods.
- *
- * The operation fails with an error if the user to be updated belongs to a different Firebase
- * project.
- *
- * @param user - The new {@link User}.
- */
- updateCurrentUser(user: User | null): Promise<void>;
- /**
- * Sets the current language to the default device/browser preference.
- */
- useDeviceLanguage(): void;
- /**
- * Signs out the current user.
- */
- signOut(): Promise<void>;
- }
-
- /**
- * Interface that represents the credentials returned by an {@link AuthProvider}.
- *
- * @remarks
- * Implementations specify the details about each auth provider's credential requirements.
- *
- * @public
- */
- export declare class AuthCredential {
- /**
- * The authentication provider ID for the credential.
- *
- * @remarks
- * For example, 'facebook.com', or 'google.com'.
- */
- readonly providerId: string;
- /**
- * The authentication sign in method for the credential.
- *
- * @remarks
- * For example, {@link SignInMethod}.EMAIL_PASSWORD, or
- * {@link SignInMethod}.EMAIL_LINK. This corresponds to the sign-in method
- * identifier as returned in {@link fetchSignInMethodsForEmail}.
- */
- readonly signInMethod: string;
- /* Excluded from this release type: __constructor */
- /**
- * Returns a JSON-serializable representation of this object.
- *
- * @returns a JSON-serializable representation of this object.
- */
- toJSON(): object;
- /* Excluded from this release type: _getIdTokenResponse */
- /* Excluded from this release type: _linkToIdToken */
- /* Excluded from this release type: _getReauthenticationResolver */
- }
-
- /**
- * Interface for an `Auth` error.
- *
- * @public
- */
- export declare interface AuthError extends FirebaseError {
- /** Details about the Firebase Auth error. */
- readonly customData: {
- /** The name of the Firebase App which triggered this error. */
- readonly appName: string;
- /** The email address of the user's account, used for sign-in and linking. */
- readonly email?: string;
- /** The phone number of the user's account, used for sign-in and linking. */
- readonly phoneNumber?: string;
- /**
- * The tenant ID being used for sign-in and linking.
- *
- * @remarks
- * If you use {@link signInWithRedirect} to sign in,
- * you have to set the tenant ID on the {@link Auth} instance again as the tenant ID is not persisted
- * after redirection.
- */
- readonly tenantId?: string;
- };
- }
-
- /* Excluded from this release type: AuthErrorCode */
-
- /**
- * A map of potential `Auth` error codes, for easier comparison with errors
- * thrown by the SDK.
- *
- * @remarks
- * Note that you can't tree-shake individual keys
- * in the map, so by using the map you might substantially increase your
- * bundle size.
- *
- * @public
- */
- export declare const AuthErrorCodes: {
- readonly ADMIN_ONLY_OPERATION: "auth/admin-restricted-operation";
- readonly ARGUMENT_ERROR: "auth/argument-error";
- readonly APP_NOT_AUTHORIZED: "auth/app-not-authorized";
- readonly APP_NOT_INSTALLED: "auth/app-not-installed";
- readonly CAPTCHA_CHECK_FAILED: "auth/captcha-check-failed";
- readonly CODE_EXPIRED: "auth/code-expired";
- readonly CORDOVA_NOT_READY: "auth/cordova-not-ready";
- readonly CORS_UNSUPPORTED: "auth/cors-unsupported";
- readonly CREDENTIAL_ALREADY_IN_USE: "auth/credential-already-in-use";
- readonly CREDENTIAL_MISMATCH: "auth/custom-token-mismatch";
- readonly CREDENTIAL_TOO_OLD_LOGIN_AGAIN: "auth/requires-recent-login";
- readonly DEPENDENT_SDK_INIT_BEFORE_AUTH: "auth/dependent-sdk-initialized-before-auth";
- readonly DYNAMIC_LINK_NOT_ACTIVATED: "auth/dynamic-link-not-activated";
- readonly EMAIL_CHANGE_NEEDS_VERIFICATION: "auth/email-change-needs-verification";
- readonly EMAIL_EXISTS: "auth/email-already-in-use";
- readonly EMULATOR_CONFIG_FAILED: "auth/emulator-config-failed";
- readonly EXPIRED_OOB_CODE: "auth/expired-action-code";
- readonly EXPIRED_POPUP_REQUEST: "auth/cancelled-popup-request";
- readonly INTERNAL_ERROR: "auth/internal-error";
- readonly INVALID_API_KEY: "auth/invalid-api-key";
- readonly INVALID_APP_CREDENTIAL: "auth/invalid-app-credential";
- readonly INVALID_APP_ID: "auth/invalid-app-id";
- readonly INVALID_AUTH: "auth/invalid-user-token";
- readonly INVALID_AUTH_EVENT: "auth/invalid-auth-event";
- readonly INVALID_CERT_HASH: "auth/invalid-cert-hash";
- readonly INVALID_CODE: "auth/invalid-verification-code";
- readonly INVALID_CONTINUE_URI: "auth/invalid-continue-uri";
- readonly INVALID_CORDOVA_CONFIGURATION: "auth/invalid-cordova-configuration";
- readonly INVALID_CUSTOM_TOKEN: "auth/invalid-custom-token";
- readonly INVALID_DYNAMIC_LINK_DOMAIN: "auth/invalid-dynamic-link-domain";
- readonly INVALID_EMAIL: "auth/invalid-email";
- readonly INVALID_EMULATOR_SCHEME: "auth/invalid-emulator-scheme";
- readonly INVALID_IDP_RESPONSE: "auth/invalid-credential";
- readonly INVALID_MESSAGE_PAYLOAD: "auth/invalid-message-payload";
- readonly INVALID_MFA_SESSION: "auth/invalid-multi-factor-session";
- readonly INVALID_OAUTH_CLIENT_ID: "auth/invalid-oauth-client-id";
- readonly INVALID_OAUTH_PROVIDER: "auth/invalid-oauth-provider";
- readonly INVALID_OOB_CODE: "auth/invalid-action-code";
- readonly INVALID_ORIGIN: "auth/unauthorized-domain";
- readonly INVALID_PASSWORD: "auth/wrong-password";
- readonly INVALID_PERSISTENCE: "auth/invalid-persistence-type";
- readonly INVALID_PHONE_NUMBER: "auth/invalid-phone-number";
- readonly INVALID_PROVIDER_ID: "auth/invalid-provider-id";
- readonly INVALID_RECIPIENT_EMAIL: "auth/invalid-recipient-email";
- readonly INVALID_SENDER: "auth/invalid-sender";
- readonly INVALID_SESSION_INFO: "auth/invalid-verification-id";
- readonly INVALID_TENANT_ID: "auth/invalid-tenant-id";
- readonly MFA_INFO_NOT_FOUND: "auth/multi-factor-info-not-found";
- readonly MFA_REQUIRED: "auth/multi-factor-auth-required";
- readonly MISSING_ANDROID_PACKAGE_NAME: "auth/missing-android-pkg-name";
- readonly MISSING_APP_CREDENTIAL: "auth/missing-app-credential";
- readonly MISSING_AUTH_DOMAIN: "auth/auth-domain-config-required";
- readonly MISSING_CODE: "auth/missing-verification-code";
- readonly MISSING_CONTINUE_URI: "auth/missing-continue-uri";
- readonly MISSING_IFRAME_START: "auth/missing-iframe-start";
- readonly MISSING_IOS_BUNDLE_ID: "auth/missing-ios-bundle-id";
- readonly MISSING_OR_INVALID_NONCE: "auth/missing-or-invalid-nonce";
- readonly MISSING_MFA_INFO: "auth/missing-multi-factor-info";
- readonly MISSING_MFA_SESSION: "auth/missing-multi-factor-session";
- readonly MISSING_PHONE_NUMBER: "auth/missing-phone-number";
- readonly MISSING_SESSION_INFO: "auth/missing-verification-id";
- readonly MODULE_DESTROYED: "auth/app-deleted";
- readonly NEED_CONFIRMATION: "auth/account-exists-with-different-credential";
- readonly NETWORK_REQUEST_FAILED: "auth/network-request-failed";
- readonly NULL_USER: "auth/null-user";
- readonly NO_AUTH_EVENT: "auth/no-auth-event";
- readonly NO_SUCH_PROVIDER: "auth/no-such-provider";
- readonly OPERATION_NOT_ALLOWED: "auth/operation-not-allowed";
- readonly OPERATION_NOT_SUPPORTED: "auth/operation-not-supported-in-this-environment";
- readonly POPUP_BLOCKED: "auth/popup-blocked";
- readonly POPUP_CLOSED_BY_USER: "auth/popup-closed-by-user";
- readonly PROVIDER_ALREADY_LINKED: "auth/provider-already-linked";
- readonly QUOTA_EXCEEDED: "auth/quota-exceeded";
- readonly REDIRECT_CANCELLED_BY_USER: "auth/redirect-cancelled-by-user";
- readonly REDIRECT_OPERATION_PENDING: "auth/redirect-operation-pending";
- readonly REJECTED_CREDENTIAL: "auth/rejected-credential";
- readonly SECOND_FACTOR_ALREADY_ENROLLED: "auth/second-factor-already-in-use";
- readonly SECOND_FACTOR_LIMIT_EXCEEDED: "auth/maximum-second-factor-count-exceeded";
- readonly TENANT_ID_MISMATCH: "auth/tenant-id-mismatch";
- readonly TIMEOUT: "auth/timeout";
- readonly TOKEN_EXPIRED: "auth/user-token-expired";
- readonly TOO_MANY_ATTEMPTS_TRY_LATER: "auth/too-many-requests";
- readonly UNAUTHORIZED_DOMAIN: "auth/unauthorized-continue-uri";
- readonly UNSUPPORTED_FIRST_FACTOR: "auth/unsupported-first-factor";
- readonly UNSUPPORTED_PERSISTENCE: "auth/unsupported-persistence-type";
- readonly UNSUPPORTED_TENANT_OPERATION: "auth/unsupported-tenant-operation";
- readonly UNVERIFIED_EMAIL: "auth/unverified-email";
- readonly USER_CANCELLED: "auth/user-cancelled";
- readonly USER_DELETED: "auth/user-not-found";
- readonly USER_DISABLED: "auth/user-disabled";
- readonly USER_MISMATCH: "auth/user-mismatch";
- readonly USER_SIGNED_OUT: "auth/user-signed-out";
- readonly WEAK_PASSWORD: "auth/weak-password";
- readonly WEB_STORAGE_UNSUPPORTED: "auth/web-storage-unsupported";
- readonly ALREADY_INITIALIZED: "auth/already-initialized";
- };
-
- /**
- * A mapping of error codes to error messages.
- *
- * @remarks
- *
- * While error messages are useful for debugging (providing verbose textual
- * context around what went wrong), these strings take up a lot of space in the
- * compiled code. When deploying code in production, using {@link prodErrorMap}
- * will save you roughly 10k compressed/gzipped over {@link debugErrorMap}. You
- * can select the error map during initialization:
- *
- * ```javascript
- * initializeAuth(app, {errorMap: debugErrorMap})
- * ```
- *
- * When initializing Auth, {@link prodErrorMap} is default.
- *
- * @public
- */
- export declare interface AuthErrorMap {
- }
-
- /* Excluded from this release type: AuthErrorParams */
-
- /* Excluded from this release type: AuthEvent */
-
- /* Excluded from this release type: AuthEventConsumer */
-
- declare interface AuthEventError extends Error {
- code: string;
- message: string;
- }
-
- /* Excluded from this release type: AuthEventType */
-
- /* Excluded from this release type: AuthInternal */
-
- declare class AuthPopup {
- readonly window: Window | null;
- associatedEvent: string | null;
- constructor(window: Window | null);
- close(): void;
- }
-
- /**
- * Interface that represents an auth provider, used to facilitate creating {@link AuthCredential}.
- *
- * @public
- */
- export declare interface AuthProvider {
- /**
- * Provider for which credentials can be constructed.
- */
- readonly providerId: string;
- }
-
- /**
- * Interface representing an {@link Auth} instance's settings.
- *
- * @remarks Currently used for enabling/disabling app verification for phone Auth testing.
- *
- * @public
- */
- export declare interface AuthSettings {
- /**
- * When set, this property disables app verification for the purpose of testing phone
- * authentication. For this property to take effect, it needs to be set before rendering a
- * reCAPTCHA app verifier. When this is disabled, a mock reCAPTCHA is rendered instead. This is
- * useful for manual testing during development or for automated integration tests.
- *
- * In order to use this feature, you will need to
- * {@link https://firebase.google.com/docs/auth/web/phone-auth#test-with-whitelisted-phone-numbers | whitelist your phone number}
- * via the Firebase Console.
- *
- * The default value is false (app verification is enabled).
- */
- appVerificationDisabledForTesting: boolean;
- }
-
- /**
- * MFA Info as returned by the API
- */
- declare interface BaseMfaEnrollment {
- mfaEnrollmentId: string;
- enrolledAt: number;
- displayName?: string;
- }
-
- /**
- * Common code to all OAuth providers. This is separate from the
- * {@link OAuthProvider} so that child providers (like
- * {@link GoogleAuthProvider}) don't inherit the `credential` instance method.
- * Instead, they rely on a static `credential` method.
- */
- declare abstract class BaseOAuthProvider extends FederatedAuthProvider implements AuthProvider {
- /* Excluded from this release type: scopes */
- /**
- * Add an OAuth scope to the credential.
- *
- * @param scope - Provider OAuth scope to add.
- */
- addScope(scope: string): AuthProvider;
- /**
- * Retrieve the current list of OAuth scopes.
- */
- getScopes(): string[];
- }
-
- /**
- * Adds a blocking callback that runs before an auth state change
- * sets a new user.
- *
- * @param auth - The {@link Auth} instance.
- * @param callback - callback triggered before new user value is set.
- * If this throws, it blocks the user from being set.
- * @param onAbort - callback triggered if a later `beforeAuthStateChanged()`
- * callback throws, allowing you to undo any side effects.
- */
- export declare function beforeAuthStateChanged(auth: Auth, callback: (user: User | null) => void | Promise<void>, onAbort?: () => void): Unsubscribe;
-
- /**
- * An implementation of {@link Persistence} of type `LOCAL` using `localStorage`
- * for the underlying storage.
- *
- * @public
- */
- export declare const browserLocalPersistence: Persistence;
-
- /**
- * An implementation of {@link PopupRedirectResolver} suitable for browser
- * based applications.
- *
- * @public
- */
- export declare const browserPopupRedirectResolver: PopupRedirectResolver;
-
- /**
- * An implementation of {@link Persistence} of `SESSION` using `sessionStorage`
- * for the underlying storage.
- *
- * @public
- */
- export declare const browserSessionPersistence: Persistence;
-
- /**
- * Checks a verification code sent to the user by email or other out-of-band mechanism.
- *
- * @returns metadata about the code.
- *
- * @param auth - The {@link Auth} instance.
- * @param oobCode - A verification code sent to the user.
- *
- * @public
- */
- export declare function checkActionCode(auth: Auth, oobCode: string): Promise<ActionCodeInfo>;
-
- /* Excluded from this release type: ClientPlatform */
- export { CompleteFn }
-
- /**
- * Interface representing the `Auth` config.
- *
- * @public
- */
- export declare interface Config {
- /**
- * The API Key used to communicate with the Firebase Auth backend.
- */
- apiKey: string;
- /**
- * The host at which the Firebase Auth backend is running.
- */
- apiHost: string;
- /**
- * The scheme used to communicate with the Firebase Auth backend.
- */
- apiScheme: string;
- /**
- * The host at which the Secure Token API is running.
- */
- tokenApiHost: string;
- /**
- * The SDK Client Version.
- */
- sdkClientVersion: string;
- /**
- * The domain at which the web widgets are hosted (provided via Firebase Config).
- */
- authDomain?: string;
- }
-
- /* Excluded from this release type: ConfigInternal */
-
- /**
- * A result from a phone number sign-in, link, or reauthenticate call.
- *
- * @public
- */
- export declare interface ConfirmationResult {
- /**
- * The phone number authentication operation's verification ID.
- *
- * @remarks
- * This can be used along with the verification code to initialize a
- * {@link PhoneAuthCredential}.
- */
- readonly verificationId: string;
- /**
- * Finishes a phone number sign-in, link, or reauthentication.
- *
- * @example
- * ```javascript
- * const confirmationResult = await signInWithPhoneNumber(auth, phoneNumber, applicationVerifier);
- * // Obtain verificationCode from the user.
- * const userCredential = await confirmationResult.confirm(verificationCode);
- * ```
- *
- * @param verificationCode - The code that was sent to the user's mobile device.
- */
- confirm(verificationCode: string): Promise<UserCredential>;
- }
-
- /**
- * Completes the password reset process, given a confirmation code and new password.
- *
- * @param auth - The {@link Auth} instance.
- * @param oobCode - A confirmation code sent to the user.
- * @param newPassword - The new password.
- *
- * @public
- */
- export declare function confirmPasswordReset(auth: Auth, oobCode: string, newPassword: string): Promise<void>;
-
- /**
- * Changes the {@link Auth} instance to communicate with the Firebase Auth Emulator, instead of production
- * Firebase Auth services.
- *
- * @remarks
- * This must be called synchronously immediately following the first call to
- * {@link initializeAuth}. Do not use with production credentials as emulator
- * traffic is not encrypted.
- *
- *
- * @example
- * ```javascript
- * connectAuthEmulator(auth, 'http://127.0.0.1:9099', { disableWarnings: true });
- * ```
- *
- * @param auth - The {@link Auth} instance.
- * @param url - The URL at which the emulator is running (eg, 'http://localhost:9099').
- * @param options - Optional. `options.disableWarnings` defaults to `false`. Set it to
- * `true` to disable the warning banner attached to the DOM.
- *
- * @public
- */
- export declare function connectAuthEmulator(auth: Auth, url: string, options?: {
- disableWarnings: boolean;
- }): void;
-
- /**
- * Creates a new user account associated with the specified email address and password.
- *
- * @remarks
- * On successful creation of the user account, this user will also be signed in to your application.
- *
- * User account creation can fail if the account already exists or the password is invalid.
- *
- * Note: The email address acts as a unique identifier for the user and enables an email-based
- * password reset. This function will create a new user account and set the initial user password.
- *
- * @param auth - The {@link Auth} instance.
- * @param email - The user's email address.
- * @param password - The user's chosen password.
- *
- * @public
- */
- export declare function createUserWithEmailAndPassword(auth: Auth, email: string, password: string): Promise<UserCredential>;
-
- /**
- * Map of OAuth Custom Parameters.
- *
- * @public
- */
- export declare type CustomParameters = Record<string, string>;
-
- /**
- * A verbose error map with detailed descriptions for most error codes.
- *
- * See discussion at {@link AuthErrorMap}
- *
- * @public
- */
- export declare const debugErrorMap: AuthErrorMap;
-
- /**
- * Deletes and signs out the user.
- *
- * @remarks
- * Important: this is a security-sensitive operation that requires the user to have recently
- * signed in. If this requirement isn't met, ask the user to authenticate again and then call
- * {@link reauthenticateWithCredential}.
- *
- * @param user - The user.
- *
- * @public
- */
- export declare function deleteUser(user: User): Promise<void>;
-
- /**
- * The dependencies that can be used to initialize an {@link Auth} instance.
- *
- * @remarks
- *
- * The modular SDK enables tree shaking by allowing explicit declarations of
- * dependencies. For example, a web app does not need to include code that
- * enables Cordova redirect sign in. That functionality is therefore split into
- * {@link browserPopupRedirectResolver} and
- * {@link cordovaPopupRedirectResolver}. The dependencies object is how Auth is
- * configured to reduce bundle sizes.
- *
- * There are two ways to initialize an {@link Auth} instance: {@link getAuth} and
- * {@link initializeAuth}. `getAuth` initializes everything using
- * platform-specific configurations, while `initializeAuth` takes a
- * `Dependencies` object directly, giving you more control over what is used.
- *
- * @public
- */
- export declare interface Dependencies {
- /**
- * Which {@link Persistence} to use. If this is an array, the first
- * `Persistence` that the device supports is used. The SDK searches for an
- * existing account in order and, if one is found in a secondary
- * `Persistence`, the account is moved to the primary `Persistence`.
- *
- * If no persistence is provided, the SDK falls back on
- * {@link inMemoryPersistence}.
- */
- persistence?: Persistence | Persistence[];
- /**
- * The {@link PopupRedirectResolver} to use. This value depends on the
- * platform. Options are {@link browserPopupRedirectResolver} and
- * {@link cordovaPopupRedirectResolver}. This field is optional if neither
- * {@link signInWithPopup} or {@link signInWithRedirect} are being used.
- */
- popupRedirectResolver?: PopupRedirectResolver;
- /**
- * Which {@link AuthErrorMap} to use.
- */
- errorMap?: AuthErrorMap;
- }
-
- /**
- * Interface that represents the credentials returned by {@link EmailAuthProvider} for
- * {@link ProviderId}.PASSWORD
- *
- * @remarks
- * Covers both {@link SignInMethod}.EMAIL_PASSWORD and
- * {@link SignInMethod}.EMAIL_LINK.
- *
- * @public
- */
- export declare class EmailAuthCredential extends AuthCredential {
- /* Excluded from this release type: _email */
- /* Excluded from this release type: _password */
- /* Excluded from this release type: _tenantId */
- /* Excluded from this release type: __constructor */
- /* Excluded from this release type: _fromEmailAndPassword */
- /* Excluded from this release type: _fromEmailAndCode */
- /** {@inheritdoc AuthCredential.toJSON} */
- toJSON(): object;
- /**
- * Static method to deserialize a JSON representation of an object into an {@link AuthCredential}.
- *
- * @param json - Either `object` or the stringified representation of the object. When string is
- * provided, `JSON.parse` would be called first.
- *
- * @returns If the JSON input does not represent an {@link AuthCredential}, null is returned.
- */
- static fromJSON(json: object | string): EmailAuthCredential | null;
- /* Excluded from this release type: _getIdTokenResponse */
- /* Excluded from this release type: _linkToIdToken */
- /* Excluded from this release type: _getReauthenticationResolver */
- }
-
- /**
- * Provider for generating {@link EmailAuthCredential}.
- *
- * @public
- */
- export declare class EmailAuthProvider implements AuthProvider {
- /**
- * Always set to {@link ProviderId}.PASSWORD, even for email link.
- */
- static readonly PROVIDER_ID: 'password';
- /**
- * Always set to {@link SignInMethod}.EMAIL_PASSWORD.
- */
- static readonly EMAIL_PASSWORD_SIGN_IN_METHOD: 'password';
- /**
- * Always set to {@link SignInMethod}.EMAIL_LINK.
- */
- static readonly EMAIL_LINK_SIGN_IN_METHOD: 'emailLink';
- /**
- * Always set to {@link ProviderId}.PASSWORD, even for email link.
- */
- readonly providerId: "password";
- /**
- * Initialize an {@link AuthCredential} using an email and password.
- *
- * @example
- * ```javascript
- * const authCredential = EmailAuthProvider.credential(email, password);
- * const userCredential = await signInWithCredential(auth, authCredential);
- * ```
- *
- * @example
- * ```javascript
- * const userCredential = await signInWithEmailAndPassword(auth, email, password);
- * ```
- *
- * @param email - Email address.
- * @param password - User account password.
- * @returns The auth provider credential.
- */
- static credential(email: string, password: string): EmailAuthCredential;
- /**
- * Initialize an {@link AuthCredential} using an email and an email link after a sign in with
- * email link operation.
- *
- * @example
- * ```javascript
- * const authCredential = EmailAuthProvider.credentialWithLink(auth, email, emailLink);
- * const userCredential = await signInWithCredential(auth, authCredential);
- * ```
- *
- * @example
- * ```javascript
- * await sendSignInLinkToEmail(auth, email);
- * // Obtain emailLink from user.
- * const userCredential = await signInWithEmailLink(auth, email, emailLink);
- * ```
- *
- * @param auth - The {@link Auth} instance used to verify the link.
- * @param email - Email address.
- * @param emailLink - Sign-in email link.
- * @returns - The auth provider credential.
- */
- static credentialWithLink(email: string, emailLink: string): EmailAuthCredential;
- }
-
- /**
- * Configuration of Firebase Authentication Emulator.
- * @public
- */
- export declare interface EmulatorConfig {
- /**
- * The protocol used to communicate with the emulator ("http"/"https").
- */
- readonly protocol: string;
- /**
- * The hostname of the emulator, which may be a domain ("localhost"), IPv4 address ("127.0.0.1")
- * or quoted IPv6 address ("[::1]").
- */
- readonly host: string;
- /**
- * The port of the emulator, or null if port isn't specified (i.e. protocol default).
- */
- readonly port: number | null;
- /**
- * The emulator-specific options.
- */
- readonly options: {
- /**
- * Whether the warning banner attached to the DOM was disabled.
- */
- readonly disableWarnings: boolean;
- };
- }
- export { ErrorFn }
-
- /* Excluded from this release type: EventManager */
-
- /**
- * Provider for generating an {@link OAuthCredential} for {@link ProviderId}.FACEBOOK.
- *
- * @example
- * ```javascript
- * // Sign in using a redirect.
- * const provider = new FacebookAuthProvider();
- * // Start a sign in process for an unauthenticated user.
- * provider.addScope('user_birthday');
- * await signInWithRedirect(auth, provider);
- * // This will trigger a full page redirect away from your app
- *
- * // After returning from the redirect when your app initializes you can obtain the result
- * const result = await getRedirectResult(auth);
- * if (result) {
- * // This is the signed-in user
- * const user = result.user;
- * // This gives you a Facebook Access Token.
- * const credential = FacebookAuthProvider.credentialFromResult(result);
- * const token = credential.accessToken;
- * }
- * ```
- *
- * @example
- * ```javascript
- * // Sign in using a popup.
- * const provider = new FacebookAuthProvider();
- * provider.addScope('user_birthday');
- * const result = await signInWithPopup(auth, provider);
- *
- * // The signed-in user info.
- * const user = result.user;
- * // This gives you a Facebook Access Token.
- * const credential = FacebookAuthProvider.credentialFromResult(result);
- * const token = credential.accessToken;
- * ```
- *
- * @public
- */
- export declare class FacebookAuthProvider extends BaseOAuthProvider {
- /** Always set to {@link SignInMethod}.FACEBOOK. */
- static readonly FACEBOOK_SIGN_IN_METHOD: 'facebook.com';
- /** Always set to {@link ProviderId}.FACEBOOK. */
- static readonly PROVIDER_ID: 'facebook.com';
- constructor();
- /**
- * Creates a credential for Facebook.
- *
- * @example
- * ```javascript
- * // `event` from the Facebook auth.authResponseChange callback.
- * const credential = FacebookAuthProvider.credential(event.authResponse.accessToken);
- * const result = await signInWithCredential(credential);
- * ```
- *
- * @param accessToken - Facebook access token.
- */
- static credential(accessToken: string): OAuthCredential;
- /**
- * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}.
- *
- * @param userCredential - The user credential.
- */
- static credentialFromResult(userCredential: UserCredential): OAuthCredential | null;
- /**
- * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was
- * thrown during a sign-in, link, or reauthenticate operation.
- *
- * @param userCredential - The user credential.
- */
- static credentialFromError(error: FirebaseError): OAuthCredential | null;
- private static credentialFromTaggedObject;
- }
-
- /**
- * An enum of factors that may be used for multifactor authentication.
- *
- * @public
- */
- export declare const FactorId: {
- /** Phone as second factor */
- readonly PHONE: "phone";
- };
-
- /**
- * The base class for all Federated providers (OAuth (including OIDC), SAML).
- *
- * This class is not meant to be instantiated directly.
- *
- * @public
- */
- declare abstract class FederatedAuthProvider implements AuthProvider {
- readonly providerId: string;
- /* Excluded from this release type: defaultLanguageCode */
- /* Excluded from this release type: customParameters */
- /**
- * Constructor for generic OAuth providers.
- *
- * @param providerId - Provider for which credentials should be generated.
- */
- constructor(providerId: string);
- /**
- * Set the language gode.
- *
- * @param languageCode - language code
- */
- setDefaultLanguage(languageCode: string | null): void;
- /**
- * Sets the OAuth custom parameters to pass in an OAuth request for popup and redirect sign-in
- * operations.
- *
- * @remarks
- * For a detailed list, check the reserved required OAuth 2.0 parameters such as `client_id`,
- * `redirect_uri`, `scope`, `response_type`, and `state` are not allowed and will be ignored.
- *
- * @param customOAuthParameters - The custom OAuth parameters to pass in the OAuth request.
- */
- setCustomParameters(customOAuthParameters: CustomParameters): AuthProvider;
- /**
- * Retrieve the current list of {@link CustomParameters}.
- */
- getCustomParameters(): CustomParameters;
- }
-
- /**
- * Gets the list of possible sign in methods for the given email address.
- *
- * @remarks
- * This is useful to differentiate methods of sign-in for the same provider, eg.
- * {@link EmailAuthProvider} which has 2 methods of sign-in,
- * {@link SignInMethod}.EMAIL_PASSWORD and
- * {@link SignInMethod}.EMAIL_LINK.
- *
- * @param auth - The {@link Auth} instance.
- * @param email - The user's email address.
- *
- * @public
- */
- export declare function fetchSignInMethodsForEmail(auth: Auth, email: string): Promise<string[]>;
-
- declare interface FinalizeMfaResponse {
- idToken: string;
- refreshToken: string;
- }
-
- /* Excluded from this release type: GenericAuthErrorParams */
-
- /**
- * Extracts provider specific {@link AdditionalUserInfo} for the given credential.
- *
- * @param userCredential - The user credential.
- *
- * @public
- */
- export declare function getAdditionalUserInfo(userCredential: UserCredential): AdditionalUserInfo | null;
-
- /**
- * Returns the Auth instance associated with the provided {@link @firebase/app#FirebaseApp}.
- * If no instance exists, initializes an Auth instance with platform-specific default dependencies.
- *
- * @param app - The Firebase App.
- *
- * @public
- */
- export declare function getAuth(app?: FirebaseApp): Auth;
-
- /**
- * Returns a JSON Web Token (JWT) used to identify the user to a Firebase service.
- *
- * @remarks
- * Returns the current token if it has not expired or if it will not expire in the next five
- * minutes. Otherwise, this will refresh the token and return a new one.
- *
- * @param user - The user.
- * @param forceRefresh - Force refresh regardless of token expiration.
- *
- * @public
- */
- export declare function getIdToken(user: User, forceRefresh?: boolean): Promise<string>;
-
- /**
- * Returns a deserialized JSON Web Token (JWT) used to identitfy the user to a Firebase service.
- *
- * @remarks
- * Returns the current token if it has not expired or if it will not expire in the next five
- * minutes. Otherwise, this will refresh the token and return a new one.
- *
- * @param user - The user.
- * @param forceRefresh - Force refresh regardless of token expiration.
- *
- * @public
- */
- export declare function getIdTokenResult(user: User, forceRefresh?: boolean): Promise<IdTokenResult>;
-
- /**
- * Provides a {@link MultiFactorResolver} suitable for completion of a
- * multi-factor flow.
- *
- * @param auth - The {@link Auth} instance.
- * @param error - The {@link MultiFactorError} raised during a sign-in, or
- * reauthentication operation.
- *
- * @public
- */
- export declare function getMultiFactorResolver(auth: Auth, error: MultiFactorError): MultiFactorResolver;
-
- /**
- * Returns a {@link UserCredential} from the redirect-based sign-in flow.
- *
- * @remarks
- * If sign-in succeeded, returns the signed in user. If sign-in was unsuccessful, fails with an
- * error. If no redirect operation was called, returns `null`.
- *
- * @example
- * ```javascript
- * // Sign in using a redirect.
- * const provider = new FacebookAuthProvider();
- * // You can add additional scopes to the provider:
- * provider.addScope('user_birthday');
- * // Start a sign in process for an unauthenticated user.
- * await signInWithRedirect(auth, provider);
- * // This will trigger a full page redirect away from your app
- *
- * // After returning from the redirect when your app initializes you can obtain the result
- * const result = await getRedirectResult(auth);
- * if (result) {
- * // This is the signed-in user
- * const user = result.user;
- * // This gives you a Facebook Access Token.
- * const credential = provider.credentialFromResult(auth, result);
- * const token = credential.accessToken;
- * }
- * // As this API can be used for sign-in, linking and reauthentication,
- * // check the operationType to determine what triggered this redirect
- * // operation.
- * const operationType = result.operationType;
- * ```
- *
- * @param auth - The {@link Auth} instance.
- * @param resolver - An instance of {@link PopupRedirectResolver}, optional
- * if already supplied to {@link initializeAuth} or provided by {@link getAuth}.
- *
- * @public
- */
- export declare function getRedirectResult(auth: Auth, resolver?: PopupRedirectResolver): Promise<UserCredential | null>;
-
- /**
- * Provider for generating an {@link OAuthCredential} for {@link ProviderId}.GITHUB.
- *
- * @remarks
- * GitHub requires an OAuth 2.0 redirect, so you can either handle the redirect directly, or use
- * the {@link signInWithPopup} handler:
- *
- * @example
- * ```javascript
- * // Sign in using a redirect.
- * const provider = new GithubAuthProvider();
- * // Start a sign in process for an unauthenticated user.
- * provider.addScope('repo');
- * await signInWithRedirect(auth, provider);
- * // This will trigger a full page redirect away from your app
- *
- * // After returning from the redirect when your app initializes you can obtain the result
- * const result = await getRedirectResult(auth);
- * if (result) {
- * // This is the signed-in user
- * const user = result.user;
- * // This gives you a Github Access Token.
- * const credential = GithubAuthProvider.credentialFromResult(result);
- * const token = credential.accessToken;
- * }
- * ```
- *
- * @example
- * ```javascript
- * // Sign in using a popup.
- * const provider = new GithubAuthProvider();
- * provider.addScope('repo');
- * const result = await signInWithPopup(auth, provider);
- *
- * // The signed-in user info.
- * const user = result.user;
- * // This gives you a Github Access Token.
- * const credential = GithubAuthProvider.credentialFromResult(result);
- * const token = credential.accessToken;
- * ```
- * @public
- */
- export declare class GithubAuthProvider extends BaseOAuthProvider {
- /** Always set to {@link SignInMethod}.GITHUB. */
- static readonly GITHUB_SIGN_IN_METHOD: 'github.com';
- /** Always set to {@link ProviderId}.GITHUB. */
- static readonly PROVIDER_ID: 'github.com';
- constructor();
- /**
- * Creates a credential for Github.
- *
- * @param accessToken - Github access token.
- */
- static credential(accessToken: string): OAuthCredential;
- /**
- * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}.
- *
- * @param userCredential - The user credential.
- */
- static credentialFromResult(userCredential: UserCredential): OAuthCredential | null;
- /**
- * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was
- * thrown during a sign-in, link, or reauthenticate operation.
- *
- * @param userCredential - The user credential.
- */
- static credentialFromError(error: FirebaseError): OAuthCredential | null;
- private static credentialFromTaggedObject;
- }
-
- /**
- * Provider for generating an an {@link OAuthCredential} for {@link ProviderId}.GOOGLE.
- *
- * @example
- * ```javascript
- * // Sign in using a redirect.
- * const provider = new GoogleAuthProvider();
- * // Start a sign in process for an unauthenticated user.
- * provider.addScope('profile');
- * provider.addScope('email');
- * await signInWithRedirect(auth, provider);
- * // This will trigger a full page redirect away from your app
- *
- * // After returning from the redirect when your app initializes you can obtain the result
- * const result = await getRedirectResult(auth);
- * if (result) {
- * // This is the signed-in user
- * const user = result.user;
- * // This gives you a Google Access Token.
- * const credential = GoogleAuthProvider.credentialFromResult(result);
- * const token = credential.accessToken;
- * }
- * ```
- *
- * @example
- * ```javascript
- * // Sign in using a popup.
- * const provider = new GoogleAuthProvider();
- * provider.addScope('profile');
- * provider.addScope('email');
- * const result = await signInWithPopup(auth, provider);
- *
- * // The signed-in user info.
- * const user = result.user;
- * // This gives you a Google Access Token.
- * const credential = GoogleAuthProvider.credentialFromResult(result);
- * const token = credential.accessToken;
- * ```
- *
- * @public
- */
- export declare class GoogleAuthProvider extends BaseOAuthProvider {
- /** Always set to {@link SignInMethod}.GOOGLE. */
- static readonly GOOGLE_SIGN_IN_METHOD: 'google.com';
- /** Always set to {@link ProviderId}.GOOGLE. */
- static readonly PROVIDER_ID: 'google.com';
- constructor();
- /**
- * Creates a credential for Google. At least one of ID token and access token is required.
- *
- * @example
- * ```javascript
- * // \`googleUser\` from the onsuccess Google Sign In callback.
- * const credential = GoogleAuthProvider.credential(googleUser.getAuthResponse().id_token);
- * const result = await signInWithCredential(credential);
- * ```
- *
- * @param idToken - Google ID token.
- * @param accessToken - Google access token.
- */
- static credential(idToken?: string | null, accessToken?: string | null): OAuthCredential;
- /**
- * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}.
- *
- * @param userCredential - The user credential.
- */
- static credentialFromResult(userCredential: UserCredential): OAuthCredential | null;
- /**
- * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was
- * thrown during a sign-in, link, or reauthenticate operation.
- *
- * @param userCredential - The user credential.
- */
- static credentialFromError(error: FirebaseError): OAuthCredential | null;
- private static credentialFromTaggedObject;
- }
-
- /**
- * Raw encoded JWT
- *
- */
- declare type IdToken = string;
-
- /* Excluded from this release type: IdTokenMfaResponse */
-
- /* Excluded from this release type: IdTokenResponse */
-
- /* Excluded from this release type: IdTokenResponseKind */
-
- /**
- * Interface representing ID token result obtained from {@link User.getIdTokenResult}.
- *
- * @remarks
- * `IdTokenResult` contains the ID token JWT string and other helper properties for getting different data
- * associated with the token as well as all the decoded payload claims.
- *
- * Note that these claims are not to be trusted as they are parsed client side. Only server side
- * verification can guarantee the integrity of the token claims.
- *
- * @public
- */
- export declare interface IdTokenResult {
- /**
- * The authentication time formatted as a UTC string.
- *
- * @remarks
- * This is the time the user authenticated (signed in) and not the time the token was refreshed.
- */
- authTime: string;
- /** The ID token expiration time formatted as a UTC string. */
- expirationTime: string;
- /** The ID token issuance time formatted as a UTC string. */
- issuedAtTime: string;
- /**
- * The sign-in provider through which the ID token was obtained (anonymous, custom, phone,
- * password, etc).
- *
- * @remarks
- * Note, this does not map to provider IDs.
- */
- signInProvider: string | null;
- /**
- * The type of second factor associated with this session, provided the user was multi-factor
- * authenticated (eg. phone, etc).
- */
- signInSecondFactor: string | null;
- /** The Firebase Auth ID token JWT string. */
- token: string;
- /**
- * The entire payload claims of the ID token including the standard reserved claims as well as
- * the custom claims.
- */
- claims: ParsedToken;
- }
-
- /**
- * An implementation of {@link Persistence} of type `LOCAL` using `indexedDB`
- * for the underlying storage.
- *
- * @public
- */
- export declare const indexedDBLocalPersistence: Persistence;
-
- /**
- * Initializes an {@link Auth} instance with fine-grained control over
- * {@link Dependencies}.
- *
- * @remarks
- *
- * This function allows more control over the {@link Auth} instance than
- * {@link getAuth}. `getAuth` uses platform-specific defaults to supply
- * the {@link Dependencies}. In general, `getAuth` is the easiest way to
- * initialize Auth and works for most use cases. Use `initializeAuth` if you
- * need control over which persistence layer is used, or to minimize bundle
- * size if you're not using either `signInWithPopup` or `signInWithRedirect`.
- *
- * For example, if your app only uses anonymous accounts and you only want
- * accounts saved for the current session, initialize `Auth` with:
- *
- * ```js
- * const auth = initializeAuth(app, {
- * persistence: browserSessionPersistence,
- * popupRedirectResolver: undefined,
- * });
- * ```
- *
- * @public
- */
- export declare function initializeAuth(app: FirebaseApp, deps?: Dependencies): Auth;
-
- /**
- * An implementation of {@link Persistence} of type 'NONE'.
- *
- * @public
- */
- export declare const inMemoryPersistence: Persistence;
-
- /**
- * Checks if an incoming link is a sign-in with email link suitable for {@link signInWithEmailLink}.
- *
- * @param auth - The {@link Auth} instance.
- * @param emailLink - The link sent to the user's email address.
- *
- * @public
- */
- export declare function isSignInWithEmailLink(auth: Auth, emailLink: string): boolean;
-
- /**
- * Links the user account with the given credentials.
- *
- * @remarks
- * An {@link AuthProvider} can be used to generate the credential.
- *
- * @param user - The user.
- * @param credential - The auth credential.
- *
- * @public
- */
- export declare function linkWithCredential(user: User, credential: AuthCredential): Promise<UserCredential>;
-
- /**
- * Links the user account with the given phone number.
- *
- * @param user - The user.
- * @param phoneNumber - The user's phone number in E.164 format (e.g. +16505550101).
- * @param appVerifier - The {@link ApplicationVerifier}.
- *
- * @public
- */
- export declare function linkWithPhoneNumber(user: User, phoneNumber: string, appVerifier: ApplicationVerifier): Promise<ConfirmationResult>;
-
- /**
- * Links the authenticated provider to the user account using a pop-up based OAuth flow.
- *
- * @remarks
- * If the linking is successful, the returned result will contain the user and the provider's credential.
- *
- *
- * @example
- * ```javascript
- * // Sign in using some other provider.
- * const result = await signInWithEmailAndPassword(auth, email, password);
- * // Link using a popup.
- * const provider = new FacebookAuthProvider();
- * await linkWithPopup(result.user, provider);
- * ```
- *
- * @param user - The user.
- * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}.
- * Non-OAuth providers like {@link EmailAuthProvider} will throw an error.
- * @param resolver - An instance of {@link PopupRedirectResolver}, optional
- * if already supplied to {@link initializeAuth} or provided by {@link getAuth}.
- *
- * @public
- */
- export declare function linkWithPopup(user: User, provider: AuthProvider, resolver?: PopupRedirectResolver): Promise<UserCredential>;
-
- /**
- * Links the {@link OAuthProvider} to the user account using a full-page redirect flow.
- * @remarks
- * To handle the results and errors for this operation, refer to {@link getRedirectResult}.
- * Follow the [best practices](https://firebase.google.com/docs/auth/web/redirect-best-practices) when using {@link linkWithRedirect}.
- *
- * @example
- * ```javascript
- * // Sign in using some other provider.
- * const result = await signInWithEmailAndPassword(auth, email, password);
- * // Link using a redirect.
- * const provider = new FacebookAuthProvider();
- * await linkWithRedirect(result.user, provider);
- * // This will trigger a full page redirect away from your app
- *
- * // After returning from the redirect when your app initializes you can obtain the result
- * const result = await getRedirectResult(auth);
- * ```
- *
- * @param user - The user.
- * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}.
- * Non-OAuth providers like {@link EmailAuthProvider} will throw an error.
- * @param resolver - An instance of {@link PopupRedirectResolver}, optional
- * if already supplied to {@link initializeAuth} or provided by {@link getAuth}.
- *
- *
- * @public
- */
- export declare function linkWithRedirect(user: User, provider: AuthProvider, resolver?: PopupRedirectResolver): Promise<never>;
-
- /**
- * MfaEnrollment can be any subtype of BaseMfaEnrollment, currently only PhoneMfaEnrollment is supported
- */
- declare type MfaEnrollment = PhoneMfaEnrollment;
-
- /**
- * The {@link MultiFactorUser} corresponding to the user.
- *
- * @remarks
- * This is used to access all multi-factor properties and operations related to the user.
- *
- * @param user - The user.
- *
- * @public
- */
- export declare function multiFactor(user: User): MultiFactorUser;
-
- /**
- * The base class for asserting ownership of a second factor.
- *
- * @remarks
- * This is used to facilitate enrollment of a second factor on an existing user or sign-in of a
- * user who already verified the first factor.
- *
- * @public
- */
- export declare interface MultiFactorAssertion {
- /** The identifier of the second factor. */
- readonly factorId: typeof FactorId[keyof typeof FactorId];
- }
-
- /**
- * The error thrown when the user needs to provide a second factor to sign in successfully.
- *
- * @remarks
- * The error code for this error is `auth/multi-factor-auth-required`.
- *
- * @example
- * ```javascript
- * let resolver;
- * let multiFactorHints;
- *
- * signInWithEmailAndPassword(auth, email, password)
- * .then((result) => {
- * // User signed in. No 2nd factor challenge is needed.
- * })
- * .catch((error) => {
- * if (error.code == 'auth/multi-factor-auth-required') {
- * resolver = getMultiFactorResolver(auth, error);
- * multiFactorHints = resolver.hints;
- * } else {
- * // Handle other errors.
- * }
- * });
- *
- * // Obtain a multiFactorAssertion by verifying the second factor.
- *
- * const userCredential = await resolver.resolveSignIn(multiFactorAssertion);
- * ```
- *
- * @public
- */
- export declare interface MultiFactorError extends AuthError {
- /** Details about the MultiFactorError. */
- readonly customData: AuthError['customData'] & {
- /**
- * The type of operation (sign-in, linking, or re-authentication) that raised the error.
- */
- readonly operationType: typeof OperationType[keyof typeof OperationType];
- };
- }
-
- /**
- * A structure containing the information of a second factor entity.
- *
- * @public
- */
- export declare interface MultiFactorInfo {
- /** The multi-factor enrollment ID. */
- readonly uid: string;
- /** The user friendly name of the current second factor. */
- readonly displayName?: string | null;
- /** The enrollment date of the second factor formatted as a UTC string. */
- readonly enrollmentTime: string;
- /** The identifier of the second factor. */
- readonly factorId: typeof FactorId[keyof typeof FactorId];
- }
-
- /**
- * The class used to facilitate recovery from {@link MultiFactorError} when a user needs to
- * provide a second factor to sign in.
- *
- * @example
- * ```javascript
- * let resolver;
- * let multiFactorHints;
- *
- * signInWithEmailAndPassword(auth, email, password)
- * .then((result) => {
- * // User signed in. No 2nd factor challenge is needed.
- * })
- * .catch((error) => {
- * if (error.code == 'auth/multi-factor-auth-required') {
- * resolver = getMultiFactorResolver(auth, error);
- * // Show UI to let user select second factor.
- * multiFactorHints = resolver.hints;
- * } else {
- * // Handle other errors.
- * }
- * });
- *
- * // The enrolled second factors that can be used to complete
- * // sign-in are returned in the `MultiFactorResolver.hints` list.
- * // UI needs to be presented to allow the user to select a second factor
- * // from that list.
- *
- * const selectedHint = // ; selected from multiFactorHints
- * const phoneAuthProvider = new PhoneAuthProvider(auth);
- * const phoneInfoOptions = {
- * multiFactorHint: selectedHint,
- * session: resolver.session
- * };
- * const verificationId = phoneAuthProvider.verifyPhoneNumber(phoneInfoOptions, appVerifier);
- * // Store `verificationId` and show UI to let user enter verification code.
- *
- * // UI to enter verification code and continue.
- * // Continue button click handler
- * const phoneAuthCredential = PhoneAuthProvider.credential(verificationId, verificationCode);
- * const multiFactorAssertion = PhoneMultiFactorGenerator.assertion(phoneAuthCredential);
- * const userCredential = await resolver.resolveSignIn(multiFactorAssertion);
- * ```
- *
- * @public
- */
- export declare interface MultiFactorResolver {
- /**
- * The list of hints for the second factors needed to complete the sign-in for the current
- * session.
- */
- readonly hints: MultiFactorInfo[];
- /**
- * The session identifier for the current sign-in flow, which can be used to complete the second
- * factor sign-in.
- */
- readonly session: MultiFactorSession;
- /**
- * A helper function to help users complete sign in with a second factor using an
- * {@link MultiFactorAssertion} confirming the user successfully completed the second factor
- * challenge.
- *
- * @example
- * ```javascript
- * const phoneAuthCredential = PhoneAuthProvider.credential(verificationId, verificationCode);
- * const multiFactorAssertion = PhoneMultiFactorGenerator.assertion(phoneAuthCredential);
- * const userCredential = await resolver.resolveSignIn(multiFactorAssertion);
- * ```
- *
- * @param assertion - The multi-factor assertion to resolve sign-in with.
- * @returns The promise that resolves with the user credential object.
- */
- resolveSignIn(assertion: MultiFactorAssertion): Promise<UserCredential>;
- }
-
- /**
- * An interface defining the multi-factor session object used for enrolling a second factor on a
- * user or helping sign in an enrolled user with a second factor.
- *
- * @public
- */
- export declare interface MultiFactorSession {
- }
-
- /**
- * An interface that defines the multi-factor related properties and operations pertaining
- * to a {@link User}.
- *
- * @public
- */
- export declare interface MultiFactorUser {
- /** Returns a list of the user's enrolled second factors. */
- readonly enrolledFactors: MultiFactorInfo[];
- /**
- * Returns the session identifier for a second factor enrollment operation. This is used to
- * identify the user trying to enroll a second factor.
- *
- * @example
- * ```javascript
- * const multiFactorUser = multiFactor(auth.currentUser);
- * const multiFactorSession = await multiFactorUser.getSession();
- *
- * // Send verification code.
- * const phoneAuthProvider = new PhoneAuthProvider(auth);
- * const phoneInfoOptions = {
- * phoneNumber: phoneNumber,
- * session: multiFactorSession
- * };
- * const verificationId = await phoneAuthProvider.verifyPhoneNumber(phoneInfoOptions, appVerifier);
- *
- * // Obtain verification code from user.
- * const phoneAuthCredential = PhoneAuthProvider.credential(verificationId, verificationCode);
- * const multiFactorAssertion = PhoneMultiFactorGenerator.assertion(phoneAuthCredential);
- * await multiFactorUser.enroll(multiFactorAssertion);
- * ```
- *
- * @returns The promise that resolves with the {@link MultiFactorSession}.
- */
- getSession(): Promise<MultiFactorSession>;
- /**
- *
- * Enrolls a second factor as identified by the {@link MultiFactorAssertion} for the
- * user.
- *
- * @remarks
- * On resolution, the user tokens are updated to reflect the change in the JWT payload.
- * Accepts an additional display name parameter used to identify the second factor to the end
- * user. Recent re-authentication is required for this operation to succeed. On successful
- * enrollment, existing Firebase sessions (refresh tokens) are revoked. When a new factor is
- * enrolled, an email notification is sent to the user’s email.
- *
- * @example
- * ```javascript
- * const multiFactorUser = multiFactor(auth.currentUser);
- * const multiFactorSession = await multiFactorUser.getSession();
- *
- * // Send verification code.
- * const phoneAuthProvider = new PhoneAuthProvider(auth);
- * const phoneInfoOptions = {
- * phoneNumber: phoneNumber,
- * session: multiFactorSession
- * };
- * const verificationId = await phoneAuthProvider.verifyPhoneNumber(phoneInfoOptions, appVerifier);
- *
- * // Obtain verification code from user.
- * const phoneAuthCredential = PhoneAuthProvider.credential(verificationId, verificationCode);
- * const multiFactorAssertion = PhoneMultiFactorGenerator.assertion(phoneAuthCredential);
- * await multiFactorUser.enroll(multiFactorAssertion);
- * // Second factor enrolled.
- * ```
- *
- * @param assertion - The multi-factor assertion to enroll with.
- * @param displayName - The display name of the second factor.
- */
- enroll(assertion: MultiFactorAssertion, displayName?: string | null): Promise<void>;
- /**
- * Unenrolls the specified second factor.
- *
- * @remarks
- * To specify the factor to remove, pass a {@link MultiFactorInfo} object (retrieved from
- * {@link MultiFactorUser.enrolledFactors}) or the
- * factor's UID string. Sessions are not revoked when the account is unenrolled. An email
- * notification is likely to be sent to the user notifying them of the change. Recent
- * re-authentication is required for this operation to succeed. When an existing factor is
- * unenrolled, an email notification is sent to the user’s email.
- *
- * @example
- * ```javascript
- * const multiFactorUser = multiFactor(auth.currentUser);
- * // Present user the option to choose which factor to unenroll.
- * await multiFactorUser.unenroll(multiFactorUser.enrolledFactors[i])
- * ```
- *
- * @param option - The multi-factor option to unenroll.
- * @returns - A `Promise` which resolves when the unenroll operation is complete.
- */
- unenroll(option: MultiFactorInfo | string): Promise<void>;
- }
-
- declare type MutableUserInfo = {
- -readonly [K in keyof UserInfo]: UserInfo[K];
- };
- export { NextFn }
-
- /**
- * Type definition for an event callback.
- *
- * @privateRemarks TODO(avolkovi): should we consolidate with Subscribe<T> since we're changing the API anyway?
- *
- * @public
- */
- export declare type NextOrObserver<T> = NextFn<T | null> | Observer<T | null>;
-
- /**
- * Represents the OAuth credentials returned by an {@link OAuthProvider}.
- *
- * @remarks
- * Implementations specify the details about each auth provider's credential requirements.
- *
- * @public
- */
- export declare class OAuthCredential extends AuthCredential {
- /**
- * The OAuth ID token associated with the credential if it belongs to an OIDC provider,
- * such as `google.com`.
- * @readonly
- */
- idToken?: string;
- /**
- * The OAuth access token associated with the credential if it belongs to an
- * {@link OAuthProvider}, such as `facebook.com`, `twitter.com`, etc.
- * @readonly
- */
- accessToken?: string;
- /**
- * The OAuth access token secret associated with the credential if it belongs to an OAuth 1.0
- * provider, such as `twitter.com`.
- * @readonly
- */
- secret?: string;
- private nonce?;
- private pendingToken;
- /* Excluded from this release type: _fromParams */
- /** {@inheritdoc AuthCredential.toJSON} */
- toJSON(): object;
- /**
- * Static method to deserialize a JSON representation of an object into an
- * {@link AuthCredential}.
- *
- * @param json - Input can be either Object or the stringified representation of the object.
- * When string is provided, JSON.parse would be called first.
- *
- * @returns If the JSON input does not represent an {@link AuthCredential}, null is returned.
- */
- static fromJSON(json: string | object): OAuthCredential | null;
- /* Excluded from this release type: _getIdTokenResponse */
- /* Excluded from this release type: _linkToIdToken */
- /* Excluded from this release type: _getReauthenticationResolver */
- private buildRequest;
- }
-
- /**
- * Defines the options for initializing an {@link OAuthCredential}.
- *
- * @remarks
- * For ID tokens with nonce claim, the raw nonce has to also be provided.
- *
- * @public
- */
- export declare interface OAuthCredentialOptions {
- /**
- * The OAuth ID token used to initialize the {@link OAuthCredential}.
- */
- idToken?: string;
- /**
- * The OAuth access token used to initialize the {@link OAuthCredential}.
- */
- accessToken?: string;
- /**
- * The raw nonce associated with the ID token.
- *
- * @remarks
- * It is required when an ID token with a nonce field is provided. The SHA-256 hash of the
- * raw nonce must match the nonce field in the ID token.
- */
- rawNonce?: string;
- }
-
- declare interface OAuthCredentialParams {
- idToken?: string | null;
- accessToken?: string | null;
- oauthToken?: string;
- secret?: string;
- oauthTokenSecret?: string;
- nonce?: string;
- pendingToken?: string;
- providerId: string;
- signInMethod: string;
- }
-
- /**
- * Provider for generating generic {@link OAuthCredential}.
- *
- * @example
- * ```javascript
- * // Sign in using a redirect.
- * const provider = new OAuthProvider('google.com');
- * // Start a sign in process for an unauthenticated user.
- * provider.addScope('profile');
- * provider.addScope('email');
- * await signInWithRedirect(auth, provider);
- * // This will trigger a full page redirect away from your app
- *
- * // After returning from the redirect when your app initializes you can obtain the result
- * const result = await getRedirectResult(auth);
- * if (result) {
- * // This is the signed-in user
- * const user = result.user;
- * // This gives you a OAuth Access Token for the provider.
- * const credential = provider.credentialFromResult(auth, result);
- * const token = credential.accessToken;
- * }
- * ```
- *
- * @example
- * ```javascript
- * // Sign in using a popup.
- * const provider = new OAuthProvider('google.com');
- * provider.addScope('profile');
- * provider.addScope('email');
- * const result = await signInWithPopup(auth, provider);
- *
- * // The signed-in user info.
- * const user = result.user;
- * // This gives you a OAuth Access Token for the provider.
- * const credential = provider.credentialFromResult(auth, result);
- * const token = credential.accessToken;
- * ```
- * @public
- */
- export declare class OAuthProvider extends BaseOAuthProvider {
- /**
- * Creates an {@link OAuthCredential} from a JSON string or a plain object.
- * @param json - A plain object or a JSON string
- */
- static credentialFromJSON(json: object | string): OAuthCredential;
- /**
- * Creates a {@link OAuthCredential} from a generic OAuth provider's access token or ID token.
- *
- * @remarks
- * The raw nonce is required when an ID token with a nonce field is provided. The SHA-256 hash of
- * the raw nonce must match the nonce field in the ID token.
- *
- * @example
- * ```javascript
- * // `googleUser` from the onsuccess Google Sign In callback.
- * // Initialize a generate OAuth provider with a `google.com` providerId.
- * const provider = new OAuthProvider('google.com');
- * const credential = provider.credential({
- * idToken: googleUser.getAuthResponse().id_token,
- * });
- * const result = await signInWithCredential(credential);
- * ```
- *
- * @param params - Either the options object containing the ID token, access token and raw nonce
- * or the ID token string.
- */
- credential(params: OAuthCredentialOptions): OAuthCredential;
- /** An internal credential method that accepts more permissive options */
- private _credential;
- /**
- * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}.
- *
- * @param userCredential - The user credential.
- */
- static credentialFromResult(userCredential: UserCredential): OAuthCredential | null;
- /**
- * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was
- * thrown during a sign-in, link, or reauthenticate operation.
- *
- * @param userCredential - The user credential.
- */
- static credentialFromError(error: FirebaseError): OAuthCredential | null;
- private static oauthCredentialFromTaggedObject;
- }
-
- /**
- * Adds an observer for changes to the user's sign-in state.
- *
- * @remarks
- * To keep the old behavior, see {@link onIdTokenChanged}.
- *
- * @param auth - The {@link Auth} instance.
- * @param nextOrObserver - callback triggered on change.
- * @param error - Deprecated. This callback is never triggered. Errors
- * on signing in/out can be caught in promises returned from
- * sign-in/sign-out functions.
- * @param completed - Deprecated. This callback is never triggered.
- *
- * @public
- */
- export declare function onAuthStateChanged(auth: Auth, nextOrObserver: NextOrObserver<User>, error?: ErrorFn, completed?: CompleteFn): Unsubscribe;
-
- /**
- * Adds an observer for changes to the signed-in user's ID token.
- *
- * @remarks
- * This includes sign-in, sign-out, and token refresh events.
- *
- * @param auth - The {@link Auth} instance.
- * @param nextOrObserver - callback triggered on change.
- * @param error - Deprecated. This callback is never triggered. Errors
- * on signing in/out can be caught in promises returned from
- * sign-in/sign-out functions.
- * @param completed - Deprecated. This callback is never triggered.
- *
- * @public
- */
- export declare function onIdTokenChanged(auth: Auth, nextOrObserver: NextOrObserver<User>, error?: ErrorFn, completed?: CompleteFn): Unsubscribe;
-
- /**
- * Enumeration of supported operation types.
- *
- * @public
- */
- export declare const OperationType: {
- /** Operation involving linking an additional provider to an already signed-in user. */
- readonly LINK: "link";
- /** Operation involving using a provider to reauthenticate an already signed-in user. */
- readonly REAUTHENTICATE: "reauthenticate";
- /** Operation involving signing in a user. */
- readonly SIGN_IN: "signIn";
- };
-
- /**
- * Parses the email action link string and returns an {@link ActionCodeURL} if
- * the link is valid, otherwise returns null.
- *
- * @public
- */
- export declare function parseActionCodeURL(link: string): ActionCodeURL | null;
-
- /**
- * Interface representing a parsed ID token.
- *
- * @privateRemarks TODO(avolkovi): consolidate with parsed_token in implementation.
- *
- * @public
- */
- export declare interface ParsedToken {
- /** Expiration time of the token. */
- 'exp'?: string;
- /** UID of the user. */
- 'sub'?: string;
- /** Time at which authentication was performed. */
- 'auth_time'?: string;
- /** Issuance time of the token. */
- 'iat'?: string;
- /** Firebase specific claims, containing the provider(s) used to authenticate the user. */
- 'firebase'?: {
- 'sign_in_provider'?: string;
- 'sign_in_second_factor'?: string;
- 'identities'?: Record<string, string>;
- };
- /** Map of any additional custom claims. */
- [key: string]: any;
- }
-
- declare type PersistedBlob = Record<string, unknown>;
-
- /**
- * An interface covering the possible persistence mechanism types.
- *
- * @public
- */
- export declare interface Persistence {
- /**
- * Type of Persistence.
- * - 'SESSION' is used for temporary persistence such as `sessionStorage`.
- * - 'LOCAL' is used for long term persistence such as `localStorage` or `IndexedDB`.
- * - 'NONE' is used for in-memory, or no persistence.
- */
- readonly type: 'SESSION' | 'LOCAL' | 'NONE';
- }
-
- /**
- * Represents the credentials returned by {@link PhoneAuthProvider}.
- *
- * @public
- */
- export declare class PhoneAuthCredential extends AuthCredential {
- private readonly params;
- private constructor();
- /* Excluded from this release type: _fromVerification */
- /* Excluded from this release type: _fromTokenResponse */
- /* Excluded from this release type: _getIdTokenResponse */
- /* Excluded from this release type: _linkToIdToken */
- /* Excluded from this release type: _getReauthenticationResolver */
- /* Excluded from this release type: _makeVerificationRequest */
- /** {@inheritdoc AuthCredential.toJSON} */
- toJSON(): object;
- /** Generates a phone credential based on a plain object or a JSON string. */
- static fromJSON(json: object | string): PhoneAuthCredential | null;
- }
-
- /**
- * Provider for generating an {@link PhoneAuthCredential}.
- *
- * @example
- * ```javascript
- * // 'recaptcha-container' is the ID of an element in the DOM.
- * const applicationVerifier = new RecaptchaVerifier('recaptcha-container');
- * const provider = new PhoneAuthProvider(auth);
- * const verificationId = await provider.verifyPhoneNumber('+16505550101', applicationVerifier);
- * // Obtain the verificationCode from the user.
- * const phoneCredential = PhoneAuthProvider.credential(verificationId, verificationCode);
- * const userCredential = await signInWithCredential(auth, phoneCredential);
- * ```
- *
- * @public
- */
- export declare class PhoneAuthProvider {
- /** Always set to {@link ProviderId}.PHONE. */
- static readonly PROVIDER_ID: 'phone';
- /** Always set to {@link SignInMethod}.PHONE. */
- static readonly PHONE_SIGN_IN_METHOD: 'phone';
- /** Always set to {@link ProviderId}.PHONE. */
- readonly providerId: "phone";
- private readonly auth;
- /**
- * @param auth - The Firebase {@link Auth} instance in which sign-ins should occur.
- *
- */
- constructor(auth: Auth);
- /**
- *
- * Starts a phone number authentication flow by sending a verification code to the given phone
- * number.
- *
- * @example
- * ```javascript
- * const provider = new PhoneAuthProvider(auth);
- * const verificationId = await provider.verifyPhoneNumber(phoneNumber, applicationVerifier);
- * // Obtain verificationCode from the user.
- * const authCredential = PhoneAuthProvider.credential(verificationId, verificationCode);
- * const userCredential = await signInWithCredential(auth, authCredential);
- * ```
- *
- * @example
- * An alternative flow is provided using the `signInWithPhoneNumber` method.
- * ```javascript
- * const confirmationResult = signInWithPhoneNumber(auth, phoneNumber, applicationVerifier);
- * // Obtain verificationCode from the user.
- * const userCredential = confirmationResult.confirm(verificationCode);
- * ```
- *
- * @param phoneInfoOptions - The user's {@link PhoneInfoOptions}. The phone number should be in
- * E.164 format (e.g. +16505550101).
- * @param applicationVerifier - For abuse prevention, this method also requires a
- * {@link ApplicationVerifier}. This SDK includes a reCAPTCHA-based implementation,
- * {@link RecaptchaVerifier}.
- *
- * @returns A Promise for a verification ID that can be passed to
- * {@link PhoneAuthProvider.credential} to identify this flow..
- */
- verifyPhoneNumber(phoneOptions: PhoneInfoOptions | string, applicationVerifier: ApplicationVerifier): Promise<string>;
- /**
- * Creates a phone auth credential, given the verification ID from
- * {@link PhoneAuthProvider.verifyPhoneNumber} and the code that was sent to the user's
- * mobile device.
- *
- * @example
- * ```javascript
- * const provider = new PhoneAuthProvider(auth);
- * const verificationId = provider.verifyPhoneNumber(phoneNumber, applicationVerifier);
- * // Obtain verificationCode from the user.
- * const authCredential = PhoneAuthProvider.credential(verificationId, verificationCode);
- * const userCredential = signInWithCredential(auth, authCredential);
- * ```
- *
- * @example
- * An alternative flow is provided using the `signInWithPhoneNumber` method.
- * ```javascript
- * const confirmationResult = await signInWithPhoneNumber(auth, phoneNumber, applicationVerifier);
- * // Obtain verificationCode from the user.
- * const userCredential = await confirmationResult.confirm(verificationCode);
- * ```
- *
- * @param verificationId - The verification ID returned from {@link PhoneAuthProvider.verifyPhoneNumber}.
- * @param verificationCode - The verification code sent to the user's mobile device.
- *
- * @returns The auth provider credential.
- */
- static credential(verificationId: string, verificationCode: string): PhoneAuthCredential;
- /**
- * Generates an {@link AuthCredential} from a {@link UserCredential}.
- * @param userCredential - The user credential.
- */
- static credentialFromResult(userCredential: UserCredential): AuthCredential | null;
- /**
- * Returns an {@link AuthCredential} when passed an error.
- *
- * @remarks
- *
- * This method works for errors like
- * `auth/account-exists-with-different-credentials`. This is useful for
- * recovering when attempting to set a user's phone number but the number
- * in question is already tied to another account. For example, the following
- * code tries to update the current user's phone number, and if that
- * fails, links the user with the account associated with that number:
- *
- * ```js
- * const provider = new PhoneAuthProvider(auth);
- * const verificationId = await provider.verifyPhoneNumber(number, verifier);
- * try {
- * const code = ''; // Prompt the user for the verification code
- * await updatePhoneNumber(
- * auth.currentUser,
- * PhoneAuthProvider.credential(verificationId, code));
- * } catch (e) {
- * if ((e as FirebaseError)?.code === 'auth/account-exists-with-different-credential') {
- * const cred = PhoneAuthProvider.credentialFromError(e);
- * await linkWithCredential(auth.currentUser, cred);
- * }
- * }
- *
- * // At this point, auth.currentUser.phoneNumber === number.
- * ```
- *
- * @param error - The error to generate a credential from.
- */
- static credentialFromError(error: FirebaseError): AuthCredential | null;
- private static credentialFromTaggedObject;
- }
-
- /**
- * The information required to verify the ownership of a phone number.
- *
- * @remarks
- * The information that's required depends on whether you are doing single-factor sign-in,
- * multi-factor enrollment or multi-factor sign-in.
- *
- * @public
- */
- export declare type PhoneInfoOptions = PhoneSingleFactorInfoOptions | PhoneMultiFactorEnrollInfoOptions | PhoneMultiFactorSignInInfoOptions;
-
- /**
- * An MFA provided by SMS verification
- */
- declare interface PhoneMfaEnrollment extends BaseMfaEnrollment {
- phoneInfo: string;
- }
-
- /**
- * The class for asserting ownership of a phone second factor. Provided by
- * {@link PhoneMultiFactorGenerator.assertion}.
- *
- * @public
- */
- export declare interface PhoneMultiFactorAssertion extends MultiFactorAssertion {
- }
-
- /**
- * Options used for enrolling a second factor.
- *
- * @public
- */
- export declare interface PhoneMultiFactorEnrollInfoOptions {
- /** Phone number to send a verification code to. */
- phoneNumber: string;
- /** The {@link MultiFactorSession} obtained via {@link MultiFactorUser.getSession}. */
- session: MultiFactorSession;
- }
-
- /**
- * Provider for generating a {@link PhoneMultiFactorAssertion}.
- *
- * @public
- */
- export declare class PhoneMultiFactorGenerator {
- private constructor();
- /**
- * Provides a {@link PhoneMultiFactorAssertion} to confirm ownership of the phone second factor.
- *
- * @param phoneAuthCredential - A credential provided by {@link PhoneAuthProvider.credential}.
- * @returns A {@link PhoneMultiFactorAssertion} which can be used with
- * {@link MultiFactorResolver.resolveSignIn}
- */
- static assertion(credential: PhoneAuthCredential): PhoneMultiFactorAssertion;
- /**
- * The identifier of the phone second factor: `phone`.
- */
- static FACTOR_ID: string;
- }
-
- /**
- * The subclass of the {@link MultiFactorInfo} interface for phone number
- * second factors. The `factorId` of this second factor is {@link FactorId}.PHONE.
- * @public
- */
- export declare interface PhoneMultiFactorInfo extends MultiFactorInfo {
- /** The phone number associated with the current second factor. */
- readonly phoneNumber: string;
- }
-
- /**
- * Options used for signing in with a second factor.
- *
- * @public
- */
- export declare interface PhoneMultiFactorSignInInfoOptions {
- /**
- * The {@link MultiFactorInfo} obtained via {@link MultiFactorResolver.hints}.
- *
- * One of `multiFactorHint` or `multiFactorUid` is required.
- */
- multiFactorHint?: MultiFactorInfo;
- /**
- * The uid of the second factor.
- *
- * One of `multiFactorHint` or `multiFactorUid` is required.
- */
- multiFactorUid?: string;
- /** The {@link MultiFactorSession} obtained via {@link MultiFactorResolver.session}. */
- session: MultiFactorSession;
- }
-
- /* Excluded from this release type: PhoneOrOauthTokenResponse */
-
- /**
- * Options used for single-factor sign-in.
- *
- * @public
- */
- export declare interface PhoneSingleFactorInfoOptions {
- /** Phone number to send a verification code to. */
- phoneNumber: string;
- }
-
- /**
- * A resolver used for handling DOM specific operations like {@link signInWithPopup}
- * or {@link signInWithRedirect}.
- *
- * @public
- */
- export declare interface PopupRedirectResolver {
- }
-
- /* Excluded from this release type: PopupRedirectResolverInternal */
-
- /**
- * A minimal error map with all verbose error messages stripped.
- *
- * See discussion at {@link AuthErrorMap}
- *
- * @public
- */
- export declare const prodErrorMap: AuthErrorMap;
-
- /**
- * Enumeration of supported providers.
- *
- * @public
- */
- export declare const ProviderId: {
- /** Facebook provider ID */
- readonly FACEBOOK: "facebook.com";
- /** GitHub provider ID */
- readonly GITHUB: "github.com";
- /** Google provider ID */
- readonly GOOGLE: "google.com";
- /** Password provider */
- readonly PASSWORD: "password";
- /** Phone provider */
- readonly PHONE: "phone";
- /** Twitter provider ID */
- readonly TWITTER: "twitter.com";
- };
-
- /* Excluded from this release type: ProviderId_2 */
-
- declare interface ProviderUserInfo {
- providerId: string;
- rawId?: string;
- email?: string;
- displayName?: string;
- photoUrl?: string;
- phoneNumber?: string;
- }
-
- /**
- * Interface for a supplied `AsyncStorage`.
- *
- * @public
- */
- export declare interface ReactNativeAsyncStorage {
- /**
- * Persist an item in storage.
- *
- * @param key - storage key.
- * @param value - storage value.
- */
- setItem(key: string, value: string): Promise<void>;
- /**
- * Retrieve an item from storage.
- *
- * @param key - storage key.
- */
- getItem(key: string): Promise<string | null>;
- /**
- * Remove an item from storage.
- *
- * @param key - storage key.
- */
- removeItem(key: string): Promise<void>;
- }
-
- /**
- * Re-authenticates a user using a fresh credential.
- *
- * @remarks
- * Use before operations such as {@link updatePassword} that require tokens from recent sign-in
- * attempts. This method can be used to recover from a `CREDENTIAL_TOO_OLD_LOGIN_AGAIN` error.
- *
- * @param user - The user.
- * @param credential - The auth credential.
- *
- * @public
- */
- export declare function reauthenticateWithCredential(user: User, credential: AuthCredential): Promise<UserCredential>;
-
- /**
- * Re-authenticates a user using a fresh phone credential.
- *
- * @remarks Use before operations such as {@link updatePassword} that require tokens from recent sign-in attempts.
- *
- * @param user - The user.
- * @param phoneNumber - The user's phone number in E.164 format (e.g. +16505550101).
- * @param appVerifier - The {@link ApplicationVerifier}.
- *
- * @public
- */
- export declare function reauthenticateWithPhoneNumber(user: User, phoneNumber: string, appVerifier: ApplicationVerifier): Promise<ConfirmationResult>;
-
- /**
- * Reauthenticates the current user with the specified {@link OAuthProvider} using a pop-up based
- * OAuth flow.
- *
- * @remarks
- * If the reauthentication is successful, the returned result will contain the user and the
- * provider's credential.
- *
- * @example
- * ```javascript
- * // Sign in using a popup.
- * const provider = new FacebookAuthProvider();
- * const result = await signInWithPopup(auth, provider);
- * // Reauthenticate using a popup.
- * await reauthenticateWithPopup(result.user, provider);
- * ```
- *
- * @param user - The user.
- * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}.
- * Non-OAuth providers like {@link EmailAuthProvider} will throw an error.
- * @param resolver - An instance of {@link PopupRedirectResolver}, optional
- * if already supplied to {@link initializeAuth} or provided by {@link getAuth}.
- *
- * @public
- */
- export declare function reauthenticateWithPopup(user: User, provider: AuthProvider, resolver?: PopupRedirectResolver): Promise<UserCredential>;
-
- /**
- * Reauthenticates the current user with the specified {@link OAuthProvider} using a full-page redirect flow.
- * @remarks
- * To handle the results and errors for this operation, refer to {@link getRedirectResult}.
- * Follow the [best practices](https://firebase.google.com/docs/auth/web/redirect-best-practices) when using {@link reauthenticateWithRedirect}.
- *
- * @example
- * ```javascript
- * // Sign in using a redirect.
- * const provider = new FacebookAuthProvider();
- * const result = await signInWithRedirect(auth, provider);
- * // This will trigger a full page redirect away from your app
- *
- * // After returning from the redirect when your app initializes you can obtain the result
- * const result = await getRedirectResult(auth);
- * // Reauthenticate using a redirect.
- * await reauthenticateWithRedirect(result.user, provider);
- * // This will again trigger a full page redirect away from your app
- *
- * // After returning from the redirect when your app initializes you can obtain the result
- * const result = await getRedirectResult(auth);
- * ```
- *
- * @param user - The user.
- * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}.
- * Non-OAuth providers like {@link EmailAuthProvider} will throw an error.
- * @param resolver - An instance of {@link PopupRedirectResolver}, optional
- * if already supplied to {@link initializeAuth} or provided by {@link getAuth}.
- *
- * @public
- */
- export declare function reauthenticateWithRedirect(user: User, provider: AuthProvider, resolver?: PopupRedirectResolver): Promise<never>;
-
- declare interface Recaptcha {
- render: (container: HTMLElement, parameters: RecaptchaParameters) => number;
- getResponse: (id: number) => string;
- execute: (id: number) => unknown;
- reset: (id: number) => unknown;
- }
-
- /* Excluded from this release type: ReCaptchaLoader */
-
- /**
- * Interface representing reCAPTCHA parameters.
- *
- * See the [reCAPTCHA docs](https://developers.google.com/recaptcha/docs/display#render_param)
- * for the list of accepted parameters. All parameters are accepted except for `sitekey`: Firebase Auth
- * provisions a reCAPTCHA for each project and will configure the site key upon rendering.
- *
- * For an invisible reCAPTCHA, set the `size` key to `invisible`.
- *
- * @public
- */
- export declare interface RecaptchaParameters {
- [key: string]: any;
- }
-
- /**
- * An {@link https://www.google.com/recaptcha/ | reCAPTCHA}-based application verifier.
- *
- * @public
- */
- export declare class RecaptchaVerifier implements ApplicationVerifierInternal {
- private readonly parameters;
- /**
- * The application verifier type.
- *
- * @remarks
- * For a reCAPTCHA verifier, this is 'recaptcha'.
- */
- readonly type = "recaptcha";
- private destroyed;
- private widgetId;
- private readonly container;
- private readonly isInvisible;
- private readonly tokenChangeListeners;
- private renderPromise;
- private readonly auth;
- /* Excluded from this release type: _recaptchaLoader */
- private recaptcha;
- /**
- *
- * @param containerOrId - The reCAPTCHA container parameter.
- *
- * @remarks
- * This has different meaning depending on whether the reCAPTCHA is hidden or visible. For a
- * visible reCAPTCHA the container must be empty. If a string is used, it has to correspond to
- * an element ID. The corresponding element must also must be in the DOM at the time of
- * initialization.
- *
- * @param parameters - The optional reCAPTCHA parameters.
- *
- * @remarks
- * Check the reCAPTCHA docs for a comprehensive list. All parameters are accepted except for
- * the sitekey. Firebase Auth backend provisions a reCAPTCHA for each project and will
- * configure this upon rendering. For an invisible reCAPTCHA, a size key must have the value
- * 'invisible'.
- *
- * @param authExtern - The corresponding Firebase {@link Auth} instance.
- */
- constructor(containerOrId: HTMLElement | string, parameters: RecaptchaParameters, authExtern: Auth);
- /**
- * Waits for the user to solve the reCAPTCHA and resolves with the reCAPTCHA token.
- *
- * @returns A Promise for the reCAPTCHA token.
- */
- verify(): Promise<string>;
- /**
- * Renders the reCAPTCHA widget on the page.
- *
- * @returns A Promise that resolves with the reCAPTCHA widget ID.
- */
- render(): Promise<number>;
- /* Excluded from this release type: _reset */
- /**
- * Clears the reCAPTCHA widget from the page and destroys the instance.
- */
- clear(): void;
- private validateStartingState;
- private makeTokenCallback;
- private assertNotDestroyed;
- private makeRenderPromise;
- private init;
- private getAssertedRecaptcha;
- }
-
- /**
- * Reloads user account data, if signed in.
- *
- * @param user - The user.
- *
- * @public
- */
- export declare function reload(user: User): Promise<void>;
-
- /**
- * An {@link AuthProvider} for SAML.
- *
- * @public
- */
- export declare class SAMLAuthProvider extends FederatedAuthProvider {
- /**
- * Constructor. The providerId must start with "saml."
- * @param providerId - SAML provider ID.
- */
- constructor(providerId: string);
- /**
- * Generates an {@link AuthCredential} from a {@link UserCredential} after a
- * successful SAML flow completes.
- *
- * @remarks
- *
- * For example, to get an {@link AuthCredential}, you could write the
- * following code:
- *
- * ```js
- * const userCredential = await signInWithPopup(auth, samlProvider);
- * const credential = SAMLAuthProvider.credentialFromResult(userCredential);
- * ```
- *
- * @param userCredential - The user credential.
- */
- static credentialFromResult(userCredential: UserCredential): AuthCredential | null;
- /**
- * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was
- * thrown during a sign-in, link, or reauthenticate operation.
- *
- * @param userCredential - The user credential.
- */
- static credentialFromError(error: FirebaseError): AuthCredential | null;
- /**
- * Creates an {@link AuthCredential} from a JSON string or a plain object.
- * @param json - A plain object or a JSON string
- */
- static credentialFromJSON(json: string | object): AuthCredential;
- private static samlCredentialFromTaggedObject;
- }
-
- /**
- * Sends a verification email to a user.
- *
- * @remarks
- * The verification process is completed by calling {@link applyActionCode}.
- *
- * @example
- * ```javascript
- * const actionCodeSettings = {
- * url: 'https://www.example.com/?email=user@example.com',
- * iOS: {
- * bundleId: 'com.example.ios'
- * },
- * android: {
- * packageName: 'com.example.android',
- * installApp: true,
- * minimumVersion: '12'
- * },
- * handleCodeInApp: true
- * };
- * await sendEmailVerification(user, actionCodeSettings);
- * // Obtain code from the user.
- * await applyActionCode(auth, code);
- * ```
- *
- * @param user - The user.
- * @param actionCodeSettings - The {@link ActionCodeSettings}.
- *
- * @public
- */
- export declare function sendEmailVerification(user: User, actionCodeSettings?: ActionCodeSettings | null): Promise<void>;
-
- /**
- * Sends a password reset email to the given email address.
- *
- * @remarks
- * To complete the password reset, call {@link confirmPasswordReset} with the code supplied in
- * the email sent to the user, along with the new password specified by the user.
- *
- * @example
- * ```javascript
- * const actionCodeSettings = {
- * url: 'https://www.example.com/?email=user@example.com',
- * iOS: {
- * bundleId: 'com.example.ios'
- * },
- * android: {
- * packageName: 'com.example.android',
- * installApp: true,
- * minimumVersion: '12'
- * },
- * handleCodeInApp: true
- * };
- * await sendPasswordResetEmail(auth, 'user@example.com', actionCodeSettings);
- * // Obtain code from user.
- * await confirmPasswordReset('user@example.com', code);
- * ```
- *
- * @param auth - The {@link Auth} instance.
- * @param email - The user's email address.
- * @param actionCodeSettings - The {@link ActionCodeSettings}.
- *
- * @public
- */
- export declare function sendPasswordResetEmail(auth: Auth, email: string, actionCodeSettings?: ActionCodeSettings): Promise<void>;
-
- /**
- * Sends a sign-in email link to the user with the specified email.
- *
- * @remarks
- * The sign-in operation has to always be completed in the app unlike other out of band email
- * actions (password reset and email verifications). This is because, at the end of the flow,
- * the user is expected to be signed in and their Auth state persisted within the app.
- *
- * To complete sign in with the email link, call {@link signInWithEmailLink} with the email
- * address and the email link supplied in the email sent to the user.
- *
- * @example
- * ```javascript
- * const actionCodeSettings = {
- * url: 'https://www.example.com/?email=user@example.com',
- * iOS: {
- * bundleId: 'com.example.ios'
- * },
- * android: {
- * packageName: 'com.example.android',
- * installApp: true,
- * minimumVersion: '12'
- * },
- * handleCodeInApp: true
- * };
- * await sendSignInLinkToEmail(auth, 'user@example.com', actionCodeSettings);
- * // Obtain emailLink from the user.
- * if(isSignInWithEmailLink(auth, emailLink)) {
- * await signInWithEmailLink(auth, 'user@example.com', emailLink);
- * }
- * ```
- *
- * @param authInternal - The {@link Auth} instance.
- * @param email - The user's email address.
- * @param actionCodeSettings - The {@link ActionCodeSettings}.
- *
- * @public
- */
- export declare function sendSignInLinkToEmail(auth: Auth, email: string, actionCodeSettings: ActionCodeSettings): Promise<void>;
-
- /**
- * Changes the type of persistence on the {@link 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.
- *
- * @remarks
- * This makes it easy for a user signing in to specify whether their session should be
- * remembered or not. It also makes it easier to never persist the `Auth` state for applications
- * that are shared by other users or have sensitive data.
- *
- * @example
- * ```javascript
- * setPersistence(auth, browserSessionPersistence);
- * ```
- *
- * @param auth - The {@link Auth} instance.
- * @param persistence - The {@link Persistence} to use.
- * @returns A `Promise` that resolves once the persistence change has completed
- *
- * @public
- */
- export declare function setPersistence(auth: Auth, persistence: Persistence): Promise<void>;
-
- /**
- * Asynchronously signs in as an anonymous user.
- *
- * @remarks
- * If there is already an anonymous user signed in, that user will be returned; otherwise, a
- * new anonymous user identity will be created and returned.
- *
- * @param auth - The {@link Auth} instance.
- *
- * @public
- */
- export declare function signInAnonymously(auth: Auth): Promise<UserCredential>;
-
- /**
- * Enumeration of supported sign-in methods.
- *
- * @public
- */
- export declare const SignInMethod: {
- /** Email link sign in method */
- readonly EMAIL_LINK: "emailLink";
- /** Email/password sign in method */
- readonly EMAIL_PASSWORD: "password";
- /** Facebook sign in method */
- readonly FACEBOOK: "facebook.com";
- /** GitHub sign in method */
- readonly GITHUB: "github.com";
- /** Google sign in method */
- readonly GOOGLE: "google.com";
- /** Phone sign in method */
- readonly PHONE: "phone";
- /** Twitter sign in method */
- readonly TWITTER: "twitter.com";
- };
-
- /**
- * Asynchronously signs in with the given credentials.
- *
- * @remarks
- * An {@link AuthProvider} can be used to generate the credential.
- *
- * @param auth - The {@link Auth} instance.
- * @param credential - The auth credential.
- *
- * @public
- */
- export declare function signInWithCredential(auth: Auth, credential: AuthCredential): Promise<UserCredential>;
-
- /**
- * Asynchronously signs in using a custom token.
- *
- * @remarks
- * Custom tokens are used to integrate Firebase Auth with existing auth systems, and must
- * be generated by an auth backend using the
- * {@link https://firebase.google.com/docs/reference/admin/node/admin.auth.Auth#createcustomtoken | createCustomToken}
- * method in the {@link https://firebase.google.com/docs/auth/admin | Admin SDK} .
- *
- * Fails with an error if the token is invalid, expired, or not accepted by the Firebase Auth service.
- *
- * @param auth - The {@link Auth} instance.
- * @param customToken - The custom token to sign in with.
- *
- * @public
- */
- export declare function signInWithCustomToken(auth: Auth, customToken: string): Promise<UserCredential>;
-
- /**
- * Asynchronously signs in using an email and password.
- *
- * @remarks
- * Fails with an error if the email address and password do not match.
- *
- * Note: The user's password is NOT the password used to access the user's email account. The
- * email address serves as a unique identifier for the user, and the password is used to access
- * the user's account in your Firebase project. See also: {@link createUserWithEmailAndPassword}.
- *
- * @param auth - The {@link Auth} instance.
- * @param email - The users email address.
- * @param password - The users password.
- *
- * @public
- */
- export declare function signInWithEmailAndPassword(auth: Auth, email: string, password: string): Promise<UserCredential>;
-
- /**
- * Asynchronously signs in using an email and sign-in email link.
- *
- * @remarks
- * If no link is passed, the link is inferred from the current URL.
- *
- * Fails with an error if the email address is invalid or OTP in email link expires.
- *
- * Note: Confirm the link is a sign-in email link before calling this method firebase.auth.Auth.isSignInWithEmailLink.
- *
- * @example
- * ```javascript
- * const actionCodeSettings = {
- * url: 'https://www.example.com/?email=user@example.com',
- * iOS: {
- * bundleId: 'com.example.ios'
- * },
- * android: {
- * packageName: 'com.example.android',
- * installApp: true,
- * minimumVersion: '12'
- * },
- * handleCodeInApp: true
- * };
- * await sendSignInLinkToEmail(auth, 'user@example.com', actionCodeSettings);
- * // Obtain emailLink from the user.
- * if(isSignInWithEmailLink(auth, emailLink)) {
- * await signInWithEmailLink(auth, 'user@example.com', emailLink);
- * }
- * ```
- *
- * @param auth - The {@link Auth} instance.
- * @param email - The user's email address.
- * @param emailLink - The link sent to the user's email address.
- *
- * @public
- */
- export declare function signInWithEmailLink(auth: Auth, email: string, emailLink?: string): Promise<UserCredential>;
-
- /* Excluded from this release type: SignInWithIdpResponse */
-
- /**
- * Asynchronously signs in using a phone number.
- *
- * @remarks
- * This method sends a code via SMS to the given
- * phone number, and returns a {@link ConfirmationResult}. After the user
- * provides the code sent to their phone, call {@link ConfirmationResult.confirm}
- * with the code to sign the user in.
- *
- * For abuse prevention, this method also requires a {@link ApplicationVerifier}.
- * This SDK includes a reCAPTCHA-based implementation, {@link RecaptchaVerifier}.
- * This function can work on other platforms that do not support the
- * {@link RecaptchaVerifier} (like React Native), but you need to use a
- * third-party {@link ApplicationVerifier} implementation.
- *
- * @example
- * ```javascript
- * // 'recaptcha-container' is the ID of an element in the DOM.
- * const applicationVerifier = new firebase.auth.RecaptchaVerifier('recaptcha-container');
- * const confirmationResult = await signInWithPhoneNumber(auth, phoneNumber, applicationVerifier);
- * // Obtain a verificationCode from the user.
- * const credential = await confirmationResult.confirm(verificationCode);
- * ```
- *
- * @param auth - The {@link Auth} instance.
- * @param phoneNumber - The user's phone number in E.164 format (e.g. +16505550101).
- * @param appVerifier - The {@link ApplicationVerifier}.
- *
- * @public
- */
- export declare function signInWithPhoneNumber(auth: Auth, phoneNumber: string, appVerifier: ApplicationVerifier): Promise<ConfirmationResult>;
-
- /* Excluded from this release type: SignInWithPhoneNumberRequest */
-
- /* Excluded from this release type: SignInWithPhoneNumberResponse */
-
- /**
- * Authenticates a Firebase client using a popup-based OAuth authentication flow.
- *
- * @remarks
- * If succeeds, returns the signed in user along with the provider's credential. If sign in was
- * unsuccessful, returns an error object containing additional information about the error.
- *
- * @example
- * ```javascript
- * // Sign in using a popup.
- * const provider = new FacebookAuthProvider();
- * const result = await signInWithPopup(auth, provider);
- *
- * // The signed-in user info.
- * const user = result.user;
- * // This gives you a Facebook Access Token.
- * const credential = provider.credentialFromResult(auth, result);
- * const token = credential.accessToken;
- * ```
- *
- * @param auth - The {@link Auth} instance.
- * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}.
- * Non-OAuth providers like {@link EmailAuthProvider} will throw an error.
- * @param resolver - An instance of {@link PopupRedirectResolver}, optional
- * if already supplied to {@link initializeAuth} or provided by {@link getAuth}.
- *
- *
- * @public
- */
- export declare function signInWithPopup(auth: Auth, provider: AuthProvider, resolver?: PopupRedirectResolver): Promise<UserCredential>;
-
- /**
- * Authenticates a Firebase client using a full-page redirect flow.
- *
- * @remarks
- * To handle the results and errors for this operation, refer to {@link getRedirectResult}.
- * Follow the [best practices](https://firebase.google.com/docs/auth/web/redirect-best-practices) when using {@link signInWithRedirect}.
- *
- * @example
- * ```javascript
- * // Sign in using a redirect.
- * const provider = new FacebookAuthProvider();
- * // You can add additional scopes to the provider:
- * provider.addScope('user_birthday');
- * // Start a sign in process for an unauthenticated user.
- * await signInWithRedirect(auth, provider);
- * // This will trigger a full page redirect away from your app
- *
- * // After returning from the redirect when your app initializes you can obtain the result
- * const result = await getRedirectResult(auth);
- * if (result) {
- * // This is the signed-in user
- * const user = result.user;
- * // This gives you a Facebook Access Token.
- * const credential = provider.credentialFromResult(auth, result);
- * const token = credential.accessToken;
- * }
- * // As this API can be used for sign-in, linking and reauthentication,
- * // check the operationType to determine what triggered this redirect
- * // operation.
- * const operationType = result.operationType;
- * ```
- *
- * @param auth - The {@link Auth} instance.
- * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}.
- * Non-OAuth providers like {@link EmailAuthProvider} will throw an error.
- * @param resolver - An instance of {@link PopupRedirectResolver}, optional
- * if already supplied to {@link initializeAuth} or provided by {@link getAuth}.
- *
- * @public
- */
- export declare function signInWithRedirect(auth: Auth, provider: AuthProvider, resolver?: PopupRedirectResolver): Promise<never>;
-
- /**
- * Signs out the current user.
- *
- * @param auth - The {@link Auth} instance.
- *
- * @public
- */
- export declare function signOut(auth: Auth): Promise<void>;
-
- /* Excluded from this release type: StsTokenManager */
-
- /* Excluded from this release type: TaggedWithTokenResponse */
-
- /**
- * Provider for generating an {@link OAuthCredential} for {@link ProviderId}.TWITTER.
- *
- * @example
- * ```javascript
- * // Sign in using a redirect.
- * const provider = new TwitterAuthProvider();
- * // Start a sign in process for an unauthenticated user.
- * await signInWithRedirect(auth, provider);
- * // This will trigger a full page redirect away from your app
- *
- * // After returning from the redirect when your app initializes you can obtain the result
- * const result = await getRedirectResult(auth);
- * if (result) {
- * // This is the signed-in user
- * const user = result.user;
- * // This gives you a Twitter Access Token and Secret.
- * const credential = TwitterAuthProvider.credentialFromResult(result);
- * const token = credential.accessToken;
- * const secret = credential.secret;
- * }
- * ```
- *
- * @example
- * ```javascript
- * // Sign in using a popup.
- * const provider = new TwitterAuthProvider();
- * const result = await signInWithPopup(auth, provider);
- *
- * // The signed-in user info.
- * const user = result.user;
- * // This gives you a Twitter Access Token and Secret.
- * const credential = TwitterAuthProvider.credentialFromResult(result);
- * const token = credential.accessToken;
- * const secret = credential.secret;
- * ```
- *
- * @public
- */
- export declare class TwitterAuthProvider extends BaseOAuthProvider {
- /** Always set to {@link SignInMethod}.TWITTER. */
- static readonly TWITTER_SIGN_IN_METHOD: 'twitter.com';
- /** Always set to {@link ProviderId}.TWITTER. */
- static readonly PROVIDER_ID: 'twitter.com';
- constructor();
- /**
- * Creates a credential for Twitter.
- *
- * @param token - Twitter access token.
- * @param secret - Twitter secret.
- */
- static credential(token: string, secret: string): OAuthCredential;
- /**
- * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}.
- *
- * @param userCredential - The user credential.
- */
- static credentialFromResult(userCredential: UserCredential): OAuthCredential | null;
- /**
- * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was
- * thrown during a sign-in, link, or reauthenticate operation.
- *
- * @param userCredential - The user credential.
- */
- static credentialFromError(error: FirebaseError): OAuthCredential | null;
- private static credentialFromTaggedObject;
- }
-
- /**
- * Unlinks a provider from a user account.
- *
- * @param user - The user.
- * @param providerId - The provider to unlink.
- *
- * @public
- */
- export declare function unlink(user: User, providerId: string): Promise<User>;
- export { Unsubscribe }
-
- /**
- * Asynchronously sets the provided user as {@link Auth.currentUser} on the
- * {@link Auth} instance.
- *
- * @remarks
- * A new instance copy of the user provided will be made and set as currentUser.
- *
- * This will trigger {@link onAuthStateChanged} and {@link onIdTokenChanged} listeners
- * like other sign in methods.
- *
- * The operation fails with an error if the user to be updated belongs to a different Firebase
- * project.
- *
- * @param auth - The {@link Auth} instance.
- * @param user - The new {@link User}.
- *
- * @public
- */
- export declare function updateCurrentUser(auth: Auth, user: User | null): Promise<void>;
-
- /**
- * Updates the user's email address.
- *
- * @remarks
- * An email will be sent to the original email address (if it was set) that allows to revoke the
- * email address change, in order to protect them from account hijacking.
- *
- * Important: this is a security sensitive operation that requires the user to have recently signed
- * in. If this requirement isn't met, ask the user to authenticate again and then call
- * {@link reauthenticateWithCredential}.
- *
- * @param user - The user.
- * @param newEmail - The new email address.
- *
- * @public
- */
- export declare function updateEmail(user: User, newEmail: string): Promise<void>;
-
- /**
- * Updates the user's password.
- *
- * @remarks
- * Important: this is a security sensitive operation that requires the user to have recently signed
- * in. If this requirement isn't met, ask the user to authenticate again and then call
- * {@link reauthenticateWithCredential}.
- *
- * @param user - The user.
- * @param newPassword - The new password.
- *
- * @public
- */
- export declare function updatePassword(user: User, newPassword: string): Promise<void>;
-
- /**
- * Updates the user's phone number.
- *
- * @example
- * ```
- * // 'recaptcha-container' is the ID of an element in the DOM.
- * const applicationVerifier = new RecaptchaVerifier('recaptcha-container');
- * const provider = new PhoneAuthProvider(auth);
- * const verificationId = await provider.verifyPhoneNumber('+16505550101', applicationVerifier);
- * // Obtain the verificationCode from the user.
- * const phoneCredential = PhoneAuthProvider.credential(verificationId, verificationCode);
- * await updatePhoneNumber(user, phoneCredential);
- * ```
- *
- * @param user - The user.
- * @param credential - A credential authenticating the new phone number.
- *
- * @public
- */
- export declare function updatePhoneNumber(user: User, credential: PhoneAuthCredential): Promise<void>;
-
- /**
- * Updates a user's profile data.
- *
- * @param user - The user.
- * @param profile - The profile's `displayName` and `photoURL` to update.
- *
- * @public
- */
- export declare function updateProfile(user: User, { displayName, photoURL: photoUrl }: {
- displayName?: string | null;
- photoURL?: string | null;
- }): Promise<void>;
-
- /**
- * Sets the current language to the default device/browser preference.
- *
- * @param auth - The {@link Auth} instance.
- *
- * @public
- */
- export declare function useDeviceLanguage(auth: Auth): void;
-
- /**
- * A user account.
- *
- * @public
- */
- export declare interface User extends UserInfo {
- /**
- * Whether the email has been verified with {@link sendEmailVerification} and
- * {@link applyActionCode}.
- */
- readonly emailVerified: boolean;
- /**
- * Whether the user is authenticated using the {@link ProviderId}.ANONYMOUS provider.
- */
- readonly isAnonymous: boolean;
- /**
- * Additional metadata around user creation and sign-in times.
- */
- readonly metadata: UserMetadata;
- /**
- * Additional per provider such as displayName and profile information.
- */
- readonly providerData: UserInfo[];
- /**
- * Refresh token used to reauthenticate the user. Avoid using this directly and prefer
- * {@link User.getIdToken} to refresh the ID token instead.
- */
- readonly refreshToken: string;
- /**
- * The user's tenant ID.
- *
- * @remarks
- * This is a read-only property, which indicates the tenant ID
- * used to sign in the user. This is null if the user is signed in from the parent
- * project.
- *
- * @example
- * ```javascript
- * // Set the tenant ID on Auth instance.
- * auth.tenantId = 'TENANT_PROJECT_ID';
- *
- * // All future sign-in request now include tenant ID.
- * const result = await signInWithEmailAndPassword(auth, email, password);
- * // result.user.tenantId should be 'TENANT_PROJECT_ID'.
- * ```
- */
- readonly tenantId: string | null;
- /**
- * Deletes and signs out the user.
- *
- * @remarks
- * Important: this is a security-sensitive operation that requires the user to have recently
- * signed in. If this requirement isn't met, ask the user to authenticate again and then call
- * one of the reauthentication methods like {@link reauthenticateWithCredential}.
- */
- delete(): Promise<void>;
- /**
- * Returns a JSON Web Token (JWT) used to identify the user to a Firebase service.
- *
- * @remarks
- * Returns the current token if it has not expired or if it will not expire in the next five
- * minutes. Otherwise, this will refresh the token and return a new one.
- *
- * @param forceRefresh - Force refresh regardless of token expiration.
- */
- getIdToken(forceRefresh?: boolean): Promise<string>;
- /**
- * Returns a deserialized JSON Web Token (JWT) used to identitfy the user to a Firebase service.
- *
- * @remarks
- * Returns the current token if it has not expired or if it will not expire in the next five
- * minutes. Otherwise, this will refresh the token and return a new one.
- *
- * @param forceRefresh - Force refresh regardless of token expiration.
- */
- getIdTokenResult(forceRefresh?: boolean): Promise<IdTokenResult>;
- /**
- * Refreshes the user, if signed in.
- */
- reload(): Promise<void>;
- /**
- * Returns a JSON-serializable representation of this object.
- *
- * @returns A JSON-serializable representation of this object.
- */
- toJSON(): object;
- }
-
- /**
- * A structure containing a {@link User}, the {@link OperationType}, and the provider ID.
- *
- * @remarks
- * `operationType` could be {@link OperationType}.SIGN_IN for a sign-in operation,
- * {@link OperationType}.LINK for a linking operation and {@link OperationType}.REAUTHENTICATE for
- * a reauthentication operation.
- *
- * @public
- */
- export declare interface UserCredential {
- /**
- * The user authenticated by this credential.
- */
- user: User;
- /**
- * The provider which was used to authenticate the user.
- */
- providerId: string | null;
- /**
- * The type of operation which was used to authenticate the user (such as sign-in or link).
- */
- operationType: typeof OperationType[keyof typeof OperationType];
- }
-
- /* Excluded from this release type: UserCredentialInternal */
-
- /**
- * User profile information, visible only to the Firebase project's apps.
- *
- * @public
- */
- export declare interface UserInfo {
- /**
- * The display name of the user.
- */
- readonly displayName: string | null;
- /**
- * The email of the user.
- */
- readonly email: string | null;
- /**
- * The phone number normalized based on the E.164 standard (e.g. +16505550101) for the
- * user.
- *
- * @remarks
- * This is null if the user has no phone credential linked to the account.
- */
- readonly phoneNumber: string | null;
- /**
- * The profile photo URL of the user.
- */
- readonly photoURL: string | null;
- /**
- * The provider used to authenticate the user.
- */
- readonly providerId: string;
- /**
- * The user's unique ID, scoped to the project.
- */
- readonly uid: string;
- }
-
- /* Excluded from this release type: UserInternal */
-
- /**
- * Interface representing a user's metadata.
- *
- * @public
- */
- export declare interface UserMetadata {
- /** Time the user was created. */
- readonly creationTime?: string;
- /** Time the user last signed in. */
- readonly lastSignInTime?: string;
- }
-
- declare class UserMetadata_2 implements UserMetadata {
- private createdAt?;
- private lastLoginAt?;
- creationTime?: string;
- lastSignInTime?: string;
- constructor(createdAt?: string | number | undefined, lastLoginAt?: string | number | undefined);
- private _initializeTime;
- _copy(metadata: UserMetadata_2): void;
- toJSON(): object;
- }
-
- /**
- * User profile used in {@link AdditionalUserInfo}.
- *
- * @public
- */
- export declare type UserProfile = Record<string, unknown>;
-
- /**
- * Sends a verification email to a new email address.
- *
- * @remarks
- * The user's email will be updated to the new one after being verified.
- *
- * If you have a custom email action handler, you can complete the verification process by calling
- * {@link applyActionCode}.
- *
- * @example
- * ```javascript
- * const actionCodeSettings = {
- * url: 'https://www.example.com/?email=user@example.com',
- * iOS: {
- * bundleId: 'com.example.ios'
- * },
- * android: {
- * packageName: 'com.example.android',
- * installApp: true,
- * minimumVersion: '12'
- * },
- * handleCodeInApp: true
- * };
- * await verifyBeforeUpdateEmail(user, 'newemail@example.com', actionCodeSettings);
- * // Obtain code from the user.
- * await applyActionCode(auth, code);
- * ```
- *
- * @param user - The user.
- * @param newEmail - The new email address to be verified before update.
- * @param actionCodeSettings - The {@link ActionCodeSettings}.
- *
- * @public
- */
- export declare function verifyBeforeUpdateEmail(user: User, newEmail: string, actionCodeSettings?: ActionCodeSettings | null): Promise<void>;
-
- /**
- * Checks a password reset code sent to the user by email or other out-of-band mechanism.
- *
- * @returns the user's email address if valid.
- *
- * @param auth - The {@link Auth} instance.
- * @param code - A verification code sent to the user.
- *
- * @public
- */
- export declare function verifyPasswordResetCode(auth: Auth, code: string): Promise<string>;
-
- export { }
|