diff --git a/docs/emulators/emulators.md b/docs/emulators/emulators.md index 15f9467ac..bb9e493d3 100644 --- a/docs/emulators/emulators.md +++ b/docs/emulators/emulators.md @@ -129,4 +129,22 @@ import { SETTINGS as FIRESTORE_SETTINGS } from '@angular/fire/firestore'; export class AppModule { } ``` +### 6.X.X Update + +By default, when serving an app with an active auth emulator, a warning message is displayed in the browser. +This message can be disabled by providing an option with the auth emulator DI Token : + +```ts +import { USE_EMULATOR as USE_AUTH_EMULATOR } from '@angular/fire/auth'; + +@NgModule({ + // ... Existing configuration + providers: [ + // ... Existing Providers + { provide: USE_AUTH_EMULATOR, useValue: environment.useEmulators ? ['localhost', 9099, {disableWarnings: true}] : undefined }, + ] +}) +export class AppModule { } +``` + For older versions, please upgrade your app to latest version to get the advantages of these new features :rocket: \ No newline at end of file diff --git a/src/auth/auth.ts b/src/auth/auth.ts index e8f5d524b..e92ef4bf5 100644 --- a/src/auth/auth.ts +++ b/src/auth/auth.ts @@ -20,7 +20,7 @@ import { ɵfetchInstance } from '@angular/fire'; export interface AngularFireAuth extends ɵPromiseProxy {} -type UseEmulatorArguments = [string, number]; +type UseEmulatorArguments = [string, number, { disableWarnings: boolean }]; export const USE_EMULATOR = new InjectionToken('angularfire2.auth.use-emulator'); export const SETTINGS = new InjectionToken('angularfire2.auth.settings'); @@ -89,7 +89,8 @@ export class AngularFireAuth { const auth = zone.runOutsideAngular(() => app.auth()); if (useEmulator) { // Firebase Auth doesn't conform to the useEmulator convention, let's smooth that over - auth.useEmulator(`http://${useEmulator.join(':')}`); + const [url, port, options] = useEmulator; + auth.useEmulator(`http://${url}:${port}`, options); } if (tenantId) { auth.tenantId = tenantId;