@@ -38,6 +38,118 @@ export class AppComponent {
3838}
3939```
4040
41+ ## Configuration with Dependency Injection
42+
43+ The AngularFireAuth Module provides several DI tokens to further configure your
44+ authentication process.
45+
46+ ### Configure
47+
48+ Using the ` SETTINGS ` DI Token (* default: null* ), we can set the current Auth
49+ instance's settings. This is used to edit/read configuration related options
50+ like app verification mode for phone authentication, which is useful for
51+ [ testing] ( https://cloud.google.com/identity-platform/docs/test-phone-numbers ) .
52+
53+ ``` ts
54+ import { SETTINGS as AUTH_SETTINGS } from ' @angular/fire/auth' ;
55+
56+ @NgModule ({
57+ // ... Existing configuration
58+ providers: [
59+ // ... Existing Providers
60+ { provide: AUTH_SETTINGS , useValue: { appVerificationDisabledForTesting: true } },
61+ ]
62+ })
63+ export class AppModule { }
64+ ```
65+
66+ Read more at [ Firebase Auth Settings] ( https://firebase.google.com/docs/reference/js/firebase.auth.AuthSettings ) .
67+
68+ ### Use Current Browser Language
69+
70+ Using the ` USE_DEVICE_LANGUAGE ` DI Token (* default: null* ), which is a boolean
71+ that allow you to set the current language to the default device/browser
72+ preference. This allows to localize emails but be aware that this only applies
73+ if you use the standard template provided by Firebase.
74+
75+ ``` ts
76+ import { USE_DEVICE_LANGUAGE } from ' @angular/fire/auth' ;
77+
78+ @NgModule ({
79+ // ... Existing configuration
80+ providers: [
81+ // ... Existing Providers
82+ { provide: USE_DEVICE_LANGUAGE , useValue: true },
83+ ]
84+ })
85+ export class AppModule { }
86+ ```
87+
88+ If you want to set a different language, you can use ` LANGUAGE_CODE ` DI Token
89+ (* default: null* ).
90+
91+ More info at the [ firebase auth docs] ( https://firebase.google.com/docs/reference/js/firebase.auth.Auth#languagecode ) .
92+
93+ ``` ts
94+ import { LANGUAGE_CODE } from ' @angular/fire/auth' ;
95+
96+ @NgModule ({
97+ // ... Existing configuration
98+ providers: [
99+ // ... Existing Providers
100+ { provide: LANGUAGE_CODE , useValue: ' fr' },
101+ ]
102+ })
103+ export class AppModule { }
104+ ```
105+
106+ ### Persistence
107+
108+ Firebase Auth default behavior is to persist a user's session even after the
109+ user closes the browser. To change the current type of persistence on the
110+ current Auth instance for the currently saved Auth session and apply this type
111+ of persistence for future sign-in requests, including sign-in with redirect
112+ requests, you can use the ` PERSISTENCE ` DI Token (* default: null* ).
113+
114+ The possible types are ` 'local' ` , ` 'session' ` or ` 'none' ` . Read more at
115+ [ authentication state persistence] ( https://firebase.google.com/docs/auth/web/auth-state-persistence ) ,
116+
117+ ``` ts
118+ import { PERSISTENCE } from ' @angular/fire/auth' ;
119+
120+ @NgModule ({
121+ // ... Existing configuration
122+ providers: [
123+ // ... Existing Providers
124+ { provide: PERSISTENCE , useValue: ' session' },
125+ ]
126+ })
127+ export class AppModule { }
128+ ```
129+
130+ ### Tenant
131+
132+ If you need to use multi-tenancy, you can set the current Auth instance's tenant
133+ ID using ` TENANT_ID ` DI Token (* default: null* ).
134+
135+ More tutorials regarding this topic are _ coming soon_ .
136+
137+ ``` ts
138+ import { TENANT_ID } from ' @angular/fire/auth' ;
139+
140+ @NgModule ({
141+ // ... Existing configuration
142+ providers: [
143+ // ... Existing Providers
144+ { provide: TENANT_ID , useValue: ' tenant-id-app-one' },
145+ ]
146+ })
147+ export class AppModule { }
148+ ```
149+
150+ - [ Multi-Tenancy Authentication] ( https://cloud.google.com/identity-platform/docs/multi-tenancy-authentication )
151+ - [ Firebase Auth Tenant] ( https://firebase.google.com/docs/reference/js/firebase.auth.Auth#tenantid )
152+
41153## UI Libraries
42154
43155- Material Design : [ ngx-auth-firebaseui] ( https://github.com/AnthonyNahas/ngx-auth-firebaseui )
0 commit comments