Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

822
Views
La propiedad 'auth' no existe en el tipo 'AngularFireAuth'

Obteniendo este error al usar angularfire. He comprobado mis importaciones y parecen ser correctas. He intentado reinstalar angularfire, sin embargo, todavía arroja este error. ¿Hay problemas con angularfire?

 import { Injectable, NgZone } from '@angular/core'; import { User } from "../services/user"; import { auth } from 'firebase/app'; import { AngularFireAuth } from "@angular/fire/auth"; import { AngularFirestore, AngularFirestoreDocument } from '@angular/fire/firestore'; import { Router } from "@angular/router"; @Injectable({ providedIn: 'root' }) export class AuthService { userData: any; // Save logged in user data constructor( public afs: AngularFirestore, // Inject Firestore service public afAuth: AngularFireAuth, // Inject Firebase auth service public router: Router, public ngZone: NgZone // NgZone service to remove outside scope warning ) { /* Saving user data in localstorage when logged in and setting up null when logged out */ this.afAuth.authState.subscribe(user => { if (user) { this.userData = user; localStorage.setItem('user', JSON.stringify(this.userData)); JSON.parse(localStorage.getItem('user')); } else { localStorage.setItem('user', null); JSON.parse(localStorage.getItem('user')); } }) } // Sign in with email/password SignIn(email, password) { return this.afAuth.auth.signInWithEmailAndPassword(email, password) .then((result) => { this.ngZone.run(() => { this.router.navigate(['dashboard']); }); this.SetUserData(result.user); }).catch((error) => { window.alert(error.message) }) }
over 4 years ago · Santiago Trujillo
9 answers
Answer question

0

Debes importar el Firebase correcto:

 import firebase from 'firebase/app';

y luego por ejemplo:

 // Sign in with Google GoogleAuth(): any { return this.AuthLogin(new firebase.auth.GoogleAuthProvider()); }
over 4 years ago · Santiago Trujillo Report

0

Simplemente elimine la "autorización", y funcionará

La propiedad 'auth' no existe en el tipo 'AngularFireAuth' #2409

over 4 years ago · Santiago Trujillo Report

0

Esto sucede debido a la nueva actualización. ¡Consulta la nota de lanzamiento! registro de cambios

@angular/fire/auth AngularFireAuth eliminó la propiedad auth y en su lugar Promise Proxies la instancia subyacente de Firebase auth.Auth

Simplemente elimine la "autorización", y funcionará

over 4 years ago · Santiago Trujillo Report

0

La siguiente solución funcionó para mí :

1. Importar base de fuego

 import firebase from "firebase/app"; import "firebase/auth";

2. luego, en el constructor, use firebase de esta manera:

 this.auth = firebase.auth;

3. luego use la función como a continuación:

 this.auth.signInWithEmailAndPassword(email, password) .then((result) => { this.ngZone.run(() => { this.router.navigate(['dashboard']); }); this.SetUserData(result.user); }).catch((error) => { window.alert(error.message) })

over 4 years ago · Santiago Trujillo Report

0

Después de verificar diferentes combinaciones, la última versión de @angular/fire que funciona con Angular 9.1.6 es 5.4.2 .

Cualquier versión anterior no le permitiría usar la propiedad auth AngularFireAuth, aunque no pude encontrar ningún aviso de desaprobación explícito en los documentos.

over 4 years ago · Santiago Trujillo Report

0

https://github.com/angular/angularfire/blob/master/docs/version-6-upgrade.md

"AngularFireAuth eliminó la propiedad auth y en su lugar Promise Proxies la instancia subyacente de Firebase auth.Auth, lo que permite que su experiencia de desarrollo refleje más de cerca el JS SDK. Se han realizado cambios similares en AngularFireFunctions, AngularFireMessaging y AngularFirePerformance".

over 4 years ago · Santiago Trujillo Report

0

Tenía el mismo problema. Parece que comienza "@angular/fire": "^6.0.0" AngularFireAuth ha eliminado la propiedad auth.

Simplemente elimine la auth y debería funcionar

https://github.com/angular/angularfire/issues/2409#issuecomment-615993136

over 4 years ago · Santiago Trujillo Report

0

Tuve el mismo problema y estaba relacionado con la falta de coincidencia de la versión en package.json . tuve

 dependencies { ... "@angular/fire": "latest", // It was 6.0.0 "firebase": "5.4.2", ... }

Luego cambié a

 dependencies { ... "@angular/fire": "5.4.2", "firebase": "5.4.2", ... }

También asegúrese de importar AngularFireAuthModule en su app.module.ts

 import { AngularFireAuthModule } from '@angular/fire/auth'; ... @NgModule({ imports: [ AngularFireAuthModule ], .... }) export class AppModule { }
over 4 years ago · Santiago Trujillo Report

0

hola noce si es la verdad pero esto me funciono

1 - npm desinstala firebase @angular/fire

2- paquete.json

3 - dependencias { ... "@angular/fire": "6.0.0", "firebase": "7.14.1", ... }

4 - cambiar

dependencias { ... "@angular/fuego": "^5.4.2",

 ...

5 - guardar

6 - npm instalar base de fuego @angular/fuego

si encuentras otra solucion mucho mejor pero por ahora esto funciono

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!