问题描述
我已经在网络上进行搜索并尝试了几乎所有的破解方法来解决此问题。
Uncaught TypeError: app.auth is not a function
at angular-fire-auth.js:42
开发人员甚至足以对此发表评论:
仍然没有运气...每一次我必须删除node_modules文件夹并安装npm才能使工作正常。
这是我的身份验证服务:
import { AngularFireAuth } from "@angular/fire/auth";
import firebase from "firebase/app";
import "firebase/auth";
...
constructor(private firebaseAuth: AngularFireAuth) {
...
}
async continueWithSocial(authProvider: string) {
let oAuthProvider: any;
if (authProvider === "google") {
oAuthProvider = new firebase.auth.GoogleAuthProvider();
} else if (authProvider === "facebook") {
oAuthProvider = new firebase.auth.FacebookAuthProvider();
}
...
}
continueWithEmail(email: string,password: string) {
let response = this.firebaseAuth
.signInWithEmailAndPassword(email,password)
.then(...)
...
}
...
关于做什么的任何想法?
解决方法
自从Firebase版本7.17.0起,我就自己遇到了这个问题。将Firebase降级为^ 7.16.0似乎可以解决此问题。