UNPKG

voluptasmollitia

Version:
42 lines (27 loc) 1.42 kB
<!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [@firebase/auth](./auth.md) &gt; [MultiFactorUser](./auth.multifactoruser.md) &gt; [getSession](./auth.multifactoruser.getsession.md) ## MultiFactorUser.getSession() method Returns the session identifier for a second factor enrollment operation. This is used to identify the user trying to enroll a second factor. <b>Signature:</b> ```typescript getSession(): Promise<MultiFactorSession>; ``` <b>Returns:</b> Promise&lt;[MultiFactorSession](./auth.multifactorsession.md)<!-- -->&gt; The promise that resolves with the [MultiFactorSession](./auth.multifactorsession.md)<!-- -->. ## 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); ```