如何配置 AngularFireAuthModule and/or AngularFireAuth 指向 auth 模拟器
How to configure AngularFireAuthModule and/or AngularFireAuth to point to auth emulator
我相信 auth 模拟器是在 2020 年 10 月末发布的。auth emulator feature reqeust
我正在尝试通过让 angular/fire/auth 调用 localhost:9099 来配置我本地服务的 angular 应用程序以使用身份验证模拟器。这可能吗?还是 angular/fire 团队目前正在处理此问题?
我在环境中的 firebase 配置参数是:
firebase: {
host: 'localhost:5000',
ssl: false,
apiKey: '<redacted>',
authDomain: 'localhost:9099',
databaseURL: '',
projectId: '<redacted>',
storageBucket: '',
messagingSenderId: ''
}
我将 auth 模拟器端口 localhost:9099 放在 authDomain 中,但这并没有起到作用。
我在 app.module.ts 文件的导入部分将 firebase 对象传递给 angularfire AngularFireModule.initializeApp(environment.firebase);
为了使用函数模拟器,我从 angular/fire/functions 包中导入了 ORIGIN 并将其安装到 运行。 doc here. I also saw SETTINGS import for use to point the Firesore to the emulator. I can't find anything in the docs 关于如何将 auth 调用指向 auth 模拟器。
虽然我认为这不是最好的地方,但这在我的服务构造函数中对我有用:
constructor(private _angularFireAuth: AngularFireAuth) {
this._angularFireAuth.useEmulator('http://localhost:9099');
}
This documentation 可以提供比构造函数实现更好的实践。我在我的项目中使用并且工作完美
我相信 auth 模拟器是在 2020 年 10 月末发布的。auth emulator feature reqeust 我正在尝试通过让 angular/fire/auth 调用 localhost:9099 来配置我本地服务的 angular 应用程序以使用身份验证模拟器。这可能吗?还是 angular/fire 团队目前正在处理此问题?
我在环境中的 firebase 配置参数是:
firebase: {
host: 'localhost:5000',
ssl: false,
apiKey: '<redacted>',
authDomain: 'localhost:9099',
databaseURL: '',
projectId: '<redacted>',
storageBucket: '',
messagingSenderId: ''
}
我将 auth 模拟器端口 localhost:9099 放在 authDomain 中,但这并没有起到作用。
我在 app.module.ts 文件的导入部分将 firebase 对象传递给 angularfire AngularFireModule.initializeApp(environment.firebase);
为了使用函数模拟器,我从 angular/fire/functions 包中导入了 ORIGIN 并将其安装到 运行。 doc here. I also saw SETTINGS import for use to point the Firesore to the emulator. I can't find anything in the docs 关于如何将 auth 调用指向 auth 模拟器。
虽然我认为这不是最好的地方,但这在我的服务构造函数中对我有用:
constructor(private _angularFireAuth: AngularFireAuth) {
this._angularFireAuth.useEmulator('http://localhost:9099');
}
This documentation 可以提供比构造函数实现更好的实践。我在我的项目中使用并且工作完美