firebase authentication persistence in electron

I’m trying to sign in a user with signInWithEmailAndPassword() but after signing the user and moving to another BrowserWindow object and initializing the auth object again with the same firebase app .. the auth.currentUser property shows as null.

I tried using the onAuthStateChanged observer as following :

onAuthStateChanged(auth,(user) => {
    console.log(user)
})

and I also tried setting the persistence using setPersistence :

onAuthStateChanged(auth,(user) => {
  setPersistence(auth,browserLocalPersistence).then(console.log(user))
})

both ended up giving me a null user