问题
I believe the auth emulator was released near the end of Oct. 2020. auth emulator feature reqeust I'm trying to configure my locally served angular app to use the auth emulator by having angular/fire/auth make calls to localhost:9099. Is that possible yet? Or is the angular/fire team currently working on this?
My firebase config parameter in environment is:
firebase: {
host: 'localhost:5000',
ssl: false,
apiKey: '<redacted>',
authDomain: 'localhost:9099',
databaseURL: '',
projectId: '<redacted>',
storageBucket: '',
messagingSenderId: ''
}
I placed the auth emulator port localhost:9099 in authDomain but that doesn't do the trick.
I pass the firebase object to angularfire in the import section of my app.module.ts file AngularFireModule.initializeApp(environment.firebase);
To use the functions emulator I imported ORIGIN from the angular/fire/functions package and have that up and running. doc here. I also saw SETTINGS import for use to point the Firesore to the emulator. I can't find anything in the docs on how to point the auth calls to the auth emulator.
回答1:
Although I think it's not the best place, this worked for me inside my service constructor:
constructor(private _angularFireAuth: AngularFireAuth) {
this._angularFireAuth.useEmulator('http://localhost:9099');
}
回答2:
This documentation can provide one best praticte like than constructor implementation. I am using in my project and worked perfectly
来源:https://stackoverflow.com/questions/64656725/how-to-configure-angularfireauthmodule-and-or-angularfireauth-to-point-to-auth-e