Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

260
Vistas
firebase (v9) How to get 'isNewUser' info after Google redirect?

I would like to check if the user is new after a Google redirect. Inside the signInWithEmailLink routine this works

let credential = await signInWithEmailLink(auth, email, window.location.href)
const details = getAdditionalUserInfo(credential)
const isNewUser = details.isNewUser

but logging this credential gives UserCredentialImpl and the credential after the redirect OAuthCredential
So this doesn't work

 const redirectResult = await getRedirectResult(auth)
        if(redirectResult) {
            try {
                const credential = GoogleAuthProvider.credentialFromResult(redirectResult);
                console.log('credential', credential)
                const details = getAdditionalUserInfo(credential)
                const isNewUser = details.isNewUser           
            } catch (error) {
                const email = error.email;
                const credential = GoogleAuthProvider.credentialFromError(error);
                console.log('error while signing in with google - getting redirect result', email, credential, error)
            }
        }

with the IDE already complaining "Argument type OAuthCredential is not assignable to parameter type UserCredential" and the error "TypeError: Cannot read properties of undefined (reading 'isAnonymous')"

How can the .isNewUser info be read after the redirect?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I just realized that the redirectResult is of type UserCredentialImpl so this works

const redirectResult = await getRedirectResult(auth)
        if(redirectResult) {
            try {      
                const details = getAdditionalUserInfo(redirectResult)
                const isNewUser = details.isNewUser
                ...           
            } catch (error) {
                ...
            }
        }

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda