Short and sweet:
- When closing / dismissing the
Google
sign-in popup (key commands OR tapping X), why is the(auth/popup-closed-by-user)
error received almost 7 seconds delayed?.
Any ideas here? I’d like it to throw the error immediately… for many reasons.
I’ve tested this on several occasions and it’s consistently delayed. Running on Safari 17.2.1 on MacBook Pro 2021
import { initializeApp } from 'https://www.gstatic.com/firebasejs/10.10.0/firebase-app.js'
import { getAuth, signInWithPopup, GoogleAuthProvider, getAdditionalUserInfo } from 'https://www.gstatic.com/firebasejs/10.10.0/firebase-auth.js'
const firebaseConfig = {
apiKey: "********",
authDomain: "********"
}
const app = initializeApp(firebaseConfig);
const auth = getAuth(app);
const provider = new GoogleAuthProvider()
export function signInWithGoogle(callback) {
auth.languageCode = 'it'
signInWithPopup(auth, provider)
.then((result) => {
const credential = GoogleAuthProvider.credentialFromResult(result)
const token = credential.accessToken
const user = result.user
const { isNewUser } = getAdditionalUserInfo(result)
callback(null, user, isNewUser)
}).catch((error) => {
const errorCode = error.code
const errorMessage = error.message
const email = error.customData.email
const credential = GoogleAuthProvider.credentialFromError(error)
console.log(errorMessage)
callback(error, null, false)
})
}