-
Notifications
You must be signed in to change notification settings - Fork 242
/
auth_apple_signin_popup.js
35 lines (30 loc) · 1.05 KB
/
auth_apple_signin_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
28
29
30
31
32
33
34
35
// This snippet file was generated by processing the source file:
// ./auth-next/apple.js
//
// To update the snippets in this file, edit the source and then run
// 'npm run snippets'.
// [START auth_apple_signin_popup_modular]
import { getAuth, signInWithPopup, OAuthProvider } from "firebase/auth";
const auth = getAuth();
signInWithPopup(auth, provider)
.then((result) => {
// The signed-in user info.
const user = result.user;
// Apple credential
const credential = OAuthProvider.credentialFromResult(result);
const accessToken = credential.accessToken;
const idToken = credential.idToken;
// IdP data available using getAdditionalUserInfo(result)
// ...
})
.catch((error) => {
// Handle Errors here.
const errorCode = error.code;
const errorMessage = error.message;
// The email of the user's account used.
const email = error.customData.email;
// The credential that was used.
const credential = OAuthProvider.credentialFromError(error);
// ...
});
// [END auth_apple_signin_popup_modular]