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

101
Vistas
Check for isNewUser with Firebase email link auth using modular JS SDK

The official snippet here says:

  // You can access the new user via result.user
  // Additional user info profile not available via:
  // result.additionalUserInfo.profile == null
  // You can check if the user is new or existing:
  // result.additionalUserInfo.isNewUser

Even the API reference says :

Object that contains additional user information as a result of a successful sign-in, link, or re-authentication operation.

However I get additionalUserInfo is undefined. I need to detect if the email link login is a new user or not.

My code:

await setPersistence(auth, browserLocalPersistence);
const result = await signInWithEmailLink(auth, email.value, window.location.href);
if (result && result.user) {
    window.localStorage.removeItem('email');
    window.localStorage.removeItem('its');
    console.log(result.additionalUserInfo.isNewUser()); // undefined
    return router.push({ path: "/dashboard" }); 
}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You need to use the getAdditionalUserInfo method separately in the new modular SDK as mentioned in this Github issue.

import {signInWithEmailLink, getAdditionalUserInfo} from "firebase/auth"

const result = await signInWithEmailLink(auth, email.value, window.location.href);
const {isNewUser} = getAdditionalUserInfo(result)
// Pass the UserCredential                ^^^^^^
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