-
Notifications
You must be signed in to change notification settings - Fork 242
/
auth_set_persistence_none.js
24 lines (22 loc) · 883 Bytes
/
auth_set_persistence_none.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
// This snippet file was generated by processing the source file:
// ./auth-next/auth-state-persistence.js
//
// To update the snippets in this file, edit the source and then run
// 'npm run snippets'.
// [START auth_set_persistence_none_modular]
import { getAuth, setPersistence, signInWithRedirect, inMemoryPersistence, GoogleAuthProvider } from "firebase/auth";
const auth = getAuth();
setPersistence(auth, inMemoryPersistence)
.then(() => {
const provider = new GoogleAuthProvider();
// In memory persistence will be applied to the signed in Google user
// even though the persistence was set to 'none' and a page redirect
// occurred.
return signInWithRedirect(auth, provider);
})
.catch((error) => {
// Handle Errors here.
const errorCode = error.code;
const errorMessage = error.message;
});
// [END auth_set_persistence_none_modular]