Hello, I report an Issue, Firebase Firestore Authentication also documentation issue

46 views
Skip to first unread message

Daniel Barbu

unread,
Feb 18, 2022, 2:21:38 PM2/18/22
to Firebase Google Group
I try to create an authentication and my compiler from Angular 12 does not recognize the red marked objects , User model does not recognize and auth in the same way, can I know how can I fix this.

Many Thanks Daniel 


import { Injectable } from '@angular/core';
import { AngularFireAuth } from "@angular/fire/compat/auth";
import { Observable } from 'rxjs';
import { User } from '../models/user.model';

export class AuthenticationService {
  userData: Observable<firebase.User> | any;

  constructor(private angularFireAuth: AngularFireAuth) {
    this.userData = angularFireAuth.authState;
  }

  /* Sign up */
  SignUp(email: string, password: string) {
    this.angularFireAuth
      .auth
      .createUserWithEmailAndPassword(email, password)
      .then(res => {
        console.log('You are Successfully signed up!', res);
      })
      .catch(error => {
        console.log('Something is wrong:', error.message);
      });
  }

  /* Sign in */
  SignIn(email: string, password: string) {
    this.angularFireAuth
      .auth
      .signInWithEmailAndPassword(email, password)
      .then(res => {
        console.log('Youre in !');
      })
      .catch(err => {
        console.log('Something went wrong:', err.message);
      });
  }

  /* Sign out */
  SignOut() {
    this.angularFireAuth
      .auth
      .signOut();
  }
}
Reply all
Reply to author
Forward
0 new messages