Getting this error when using angularfire. Have checked my imports and they seem to be correct. I have tried to reinstall angularfire however it is still throwing this error. Is there issues with 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) }) }
Had the same problem. Seems starting "@angular/fire": "^6.0.0"
AngularFireAuth has dropped the auth property.
Just delete auth
& it should work
https://github.com/angular/angularfire/issues/2409#issuecomment-615993136
Just delete the "auth", and it will work
Property 'auth' does not exist on type 'AngularFireAuth' #2409
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With