How to auth using provider in angular fire auth?
I'm trying to authenticate users using auth providers.
this is what all the tutorials out there suggests,
to create a provider instance using import { auth } from 'firebase/app';
But I get the error:
'"firebase/app"' has no exported member 'auth'
Following is the code:
import { Injectable } from '@angular/core';
import { auth } from 'firebase/app';
import { AngularFireAuth } from "@angular/fire/auth";
@Injectable({
providedIn: 'root'
})
export class AuthService {
constructor(
public afAuth: AngularFireAuth, // Inject Firebase auth service
) { }
// Sign in with Facebook
FacebookAuth() {
return this.AuthLogin(new auth.FacebookAuthProvider());
}
// Auth logic to run auth providers
AuthLogin(provider) {
return this.afAuth.auth.signInWithPopup(provider)
.then((result) => {
console.log('You have been successfully logged in!')
}).catch((error) => {
console.log(error)
})
}
}
But when I try to import this import { auth } from 'firebase/app';, the compiler throws error saying that the module has no exported member called auth. May I know how can I work it out?
Or is there a new method for this, other than using any third party libraries like angularx-social-login or ngx-auth-firebaseui