Last active
September 26, 2021 16:34
-
-
Save ShekMak/0fa2662a76f07f8d08913633b5f93a02 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
import { AngularFireAuth } from '@angular/fire/compat/auth'; | |
import firebase from '@firebase/app-compat'; | |
import { Observable } from 'rxjs'; | |
@Injectable({ | |
providedIn: 'root' | |
}) | |
export class AuthService { | |
constructor(private angularFireAuth: AngularFireAuth) { } | |
getCurrentUser(): Observable<any> { | |
return this.angularFireAuth.authState; | |
} | |
signUpWithEmailAndPassword(email: string, password: string): Promise<any> { | |
return this.angularFireAuth.createUserWithEmailAndPassword(email, password); | |
} | |
signInWithEmailAndPassword(email: string, password: string): Promise<any> { | |
return this.angularFireAuth.signInWithEmailAndPassword(email, password); | |
} | |
signInWithProvider(provider: any): Promise<any> { | |
return this.angularFireAuth.signInWithRedirect(provider); | |
} | |
signInWithGoogle(): Promise<any> { | |
return this.signInWithProvider(new firebase.auth.GoogleAuthProvider()); | |
} | |
signOut(): Promise<any> { | |
return this.angularFireAuth.signOut(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment