1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

AngularFire: get the isNewUser flag;

Discussão em 'Angular' iniciado por pax, Outubro 17, 2024 às 04:43.

  1. pax

    pax Guest

    I need to get hold of the 'additionalUserInfo.isNewUser'.

    import { User, getAdditionalUserInfo, getAuth, user, UserCredential } from '@angular/fire/auth';

    afAuth = getAuth();

    user$: Observable<User | null> = user(this.afAuth);

    userSubscription = this.user$
    .pipe(
    switchMap(firebaseUser => {

    if (!firebaseUser) return of(null);

    return from(firebaseUser.getIdTokenResult())
    .pipe(
    map(idTokenResult => {
    // ... map claims from token to user object;
    return userWithClaims;
    }),

    //TODO: I need the 'additionalUserInfo.isNewUser' here
    );
    }),
    ...


    AngularFire provides the 'UserCredential' interface and the 'getAdditionalUserInfo' method,
    but I don't know where to get the 'userCredential' object from.

    getAdditionalUserInfo(userCredential: UserCredential) { ... }


    I wasn't able to find anything helpful in the "Convenience observables" section.

    Continue reading...

Compartilhe esta Página