@@ -41,7 +41,7 @@ Auth guides at the following links:
41
41
- [ Email and password] ( https://firebase.google.com/docs/auth/ios/password-auth#before_you_begin )
42
42
- [ Google] ( https://firebase.google.com/docs/auth/ios/google-signin#before_you_begin )
43
43
- [ Facebook] ( https://firebase.google.com/docs/auth/ios/facebook-login#before_you_begin )
44
-
44
+ - [ Twitter ] ( https://firebase.google.com/docs/auth/ios/twitter-login#before_you_begin )
45
45
46
46
## Using FirebaseUI for Authentication
47
47
@@ -149,14 +149,14 @@ present the `authViewController` obtain as instance as follows:
149
149
// Present the auth view controller and then implement the sign in callback.
150
150
let authViewController = authUI! .authViewController ()
151
151
152
- func authUI (_ authUI : FIRAuthUI, didSignInWithUser user : FIRUser? , error : Error ? ) {
152
+ func authUI (_ authUI : FIRAuthUI, didSignInWith user : FIRUser? , error : Error ? ) {
153
153
// handle user and error as necessary
154
154
}
155
155
```
156
156
157
157
``` objective-c
158
158
// objc
159
- UIViewController *authViewController = [authUI authViewController ];
159
+ UINavigationController *authViewController = [authUI authViewController ];
160
160
// Use authViewController as your root view controller,
161
161
// or present it on top of an existing view controller.
162
162
@@ -207,7 +207,7 @@ should have the same key as its counterpart in the default `.strings` files.
207
207
### Custom sign-in screen
208
208
209
209
You can customize everything about the authentication method picker screen,
210
- except for the actual sign-in buttons.
210
+ except for the actual sign-in buttons and their position .
211
211
212
212
In order to do so, create a subclass of ` FIRAuthPickerViewController ` and
213
213
customize it to your needs. Provide ` FIRAuthUI ` with an instance of your
@@ -227,3 +227,85 @@ func authPickerViewController(for authUI: FIRAuthUI) -> FIRAuthPickerViewControl
227
227
return [[ CustomAuthPickerViewController alloc] initWithAuthUI: authUI ] ;
228
228
}
229
229
```
230
+
231
+ ### Custom Email Identity provider screens
232
+
233
+ You can entirely customize all email provider screens. Which includes but not limited to:
234
+ - hide top ` UINavigationBar `
235
+ - add ` Cancel ` button
236
+ - change type of controls (don't use ` UITableView ` )
237
+ Things that are not customizable:
238
+ - ` UIAlertController ` popups (you can't show error label instead of alert controller)
239
+ - modification of screen flow (you can't combine screens, skip particular screens)
240
+ - disabling validation (e g email validation)
241
+
242
+ In order to achieve email provider screen customization, create subclass of appropriate controller and implement it to your needs. Provide ` FIRAuthUI ` with an instance of your
243
+ subclass by implementing the delegate methods:
244
+ ``` swift
245
+ // swift
246
+ func emailEntryViewController (for authUI : FIRAuthUI) -> FIREmailEntryViewController {
247
+ return CustomEmailEntryViewController (authUI : authUI)
248
+ }
249
+
250
+ func passwordSignInViewController (for authUI : FIRAuthUI, email : String ) -> FIRPasswordSignInViewController {
251
+ return CustomPasswordSignInViewController (authUI : authUI, email : email)
252
+ }
253
+
254
+ func passwordSignUpViewController (for authUI : FIRAuthUI, email : String ) -> FIRPasswordSignUpViewController {
255
+ return CustomPasswordSignUpViewController (authUI : authUI, email : email)
256
+ }
257
+
258
+ func passwordRecoveryViewController (for authUI : FIRAuthUI, email : String ) -> FIRPasswordRecoveryViewController {
259
+ return CustomPasswordRecoveryViewController (authUI : authUI, email : email)
260
+ }
261
+
262
+ func passwordVerificationViewController (for authUI : FIRAuthUI, email : String , newCredential : FIRAuthCredential) -> FIRPasswordVerificationViewController {
263
+ return CustomPasswordVerificationViewController (authUI : authUI, email : email, newCredential : newCredential)
264
+ }
265
+
266
+ ```
267
+
268
+ ``` objective-c
269
+ // objc
270
+ - (FIREmailEntryViewController *)emailEntryViewControllerForAuthUI:(FIRAuthUI *)authUI {
271
+ return [[ CustomEmailEntryViewController alloc] initWithAuthUI: authUI ] ;
272
+
273
+ }
274
+
275
+ - (FIRPasswordSignInViewController *)passwordSignInViewControllerForAuthUI:(FIRAuthUI *)authUI
276
+ email:(NSString *)email {
277
+ return [[ CustomPasswordSignInViewController alloc] initWithAuthUI: authUI
278
+ email: email ] ;
279
+
280
+ }
281
+
282
+ - (FIRPasswordSignUpViewController *)passwordSignUpViewControllerForAuthUI:(FIRAuthUI *)authUI
283
+ email:(NSString *)email {
284
+ return [[ CustomPasswordSignUpViewController alloc] initWithAuthUI: authUI
285
+ email: email ] ;
286
+
287
+ }
288
+
289
+ - (FIRPasswordRecoveryViewController *)passwordRecoveryViewControllerForAuthUI:(FIRAuthUI *)authUI
290
+ email:(NSString *)email {
291
+ return [[ CustomPasswordRecoveryViewController alloc] initWithAuthUI: authUI
292
+ email: email ] ;
293
+
294
+ }
295
+
296
+ - (FIRPasswordVerificationViewController *)passwordVerificationViewControllerForAuthUI:(FIRAuthUI *)authUI
297
+ email:(NSString *)email
298
+ newCredential:(FIRAuthCredential *)newCredential {
299
+ return [[ CustomPasswordVerificationViewController alloc] initWithAuthUI: authUI
300
+ email: email
301
+ newCredential: newCredential ] ;
302
+ }
303
+ ```
304
+
305
+ While customizing call original methods (see subclassed header). Most frequent but not limited are:
306
+ - ` - (void)onNext:(NSString *)textFieldValue; ` // or any action which lead to the next screen
307
+ - ` - (void)didChangeTextField:(NSString *)textFieldValue; ` // usually called in viewWillAppear and after modification of entry text field;
308
+ - ` - (void)onBack; `
309
+ - ` - (void)cancelAuthorization; `
310
+
311
+ You can refer to objective-c and swift samples to see how customization can be achieved.
0 commit comments