I’m trying to set the persistence to ‘Session’ using typescript/react, but getting type errors.
Here is some of code:
import { auth } from "../auth/firebase";
import {
createUserWithEmailAndPassword,
sendPasswordResetEmail,
setPersistence,
signInWithCustomToken,
signInWithEmailAndPassword,
updateProfile,
} from "firebase/auth";
This is my useEffect:
useEffect(() => {
console.log("here useEffect");
auth.setPersistence(auth.Auth.SESSION.NONE); //Property 'Auth' does not exist on type 'Auth'.
const unsubscribe = auth.onAuthStateChanged((user: any) => //this works fine
I tried a different solution I found here, that looked like this:
setPersistence(auth, {type: 'LOCAL'});
This didn’t work either.