setPersistence on Firebase

I have tried t implement a method of persisted authentication following firebase online tutorial.
I wrote the following code:

const signIn = async () => {
await setPersistence(auth, browserLocalPersistence)
await signInWithPopup(auth, provider)
navigate(“/Account”)
}

where the imports are:
import { browserLocalPersistence, getAuth, GoogleAuthProvider , setPersistence, signInWithPopup} from “firebase/auth”

However everytime I refresh the application the it logs me out of the website. Does anybody know what the problem is

I tried following the tutorial attentively and I have made sure that setPersistence runs before signInWithPopup but it is just not working