-
Notifications
You must be signed in to change notification settings - Fork 242
/
auth_msft_reauth_popup.js
27 lines (24 loc) · 1.01 KB
/
auth_msft_reauth_popup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// This snippet file was generated by processing the source file:
// ./auth-next/microsoft-oauth.js
//
// To update the snippets in this file, edit the source and then run
// 'npm run snippets'.
// [START auth_msft_reauth_popup_modular]
import { getAuth, reauthenticateWithPopup, OAuthProvider } from "firebase/auth";
const provider = new OAuthProvider('microsoft.com');
const auth = getAuth();
reauthenticateWithPopup(auth.currentUser, provider)
.then((result) => {
// User is re-authenticated with fresh tokens minted and
// should be able to perform sensitive operations like account
// deletion and email or password update.
// IdP data available in result.additionalUserInfo.profile.
// Get the OAuth access token and ID Token
const credential = OAuthProvider.credentialFromResult(result);
const accessToken = credential.accessToken;
const idToken = credential.idToken;
})
.catch((error) => {
// Handle error.
});
// [END auth_msft_reauth_popup_modular]