Skip to content

Commit 1981484

Browse files
committed
update Firebase Auth readme file
1 parent 4d0985b commit 1981484

File tree

1 file changed

+86
-4
lines changed

1 file changed

+86
-4
lines changed

FirebaseAuthUI/README.md

Lines changed: 86 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Auth guides at the following links:
4141
- [Email and password](https://firebase.google.com/docs/auth/ios/password-auth#before_you_begin)
4242
- [Google](https://firebase.google.com/docs/auth/ios/google-signin#before_you_begin)
4343
- [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)
4545

4646
## Using FirebaseUI for Authentication
4747

@@ -149,14 +149,14 @@ present the `authViewController` obtain as instance as follows:
149149
// Present the auth view controller and then implement the sign in callback.
150150
let authViewController = authUI!.authViewController()
151151

152-
func authUI(_ authUI: FIRAuthUI, didSignInWithUser user: FIRUser?, error: Error?) {
152+
func authUI(_ authUI: FIRAuthUI, didSignInWith user: FIRUser?, error: Error?) {
153153
// handle user and error as necessary
154154
}
155155
```
156156

157157
```objective-c
158158
// objc
159-
UIViewController *authViewController = [authUI authViewController];
159+
UINavigationController *authViewController = [authUI authViewController];
160160
// Use authViewController as your root view controller,
161161
// or present it on top of an existing view controller.
162162

@@ -207,7 +207,7 @@ should have the same key as its counterpart in the default `.strings` files.
207207
### Custom sign-in screen
208208

209209
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.
211211

212212
In order to do so, create a subclass of `FIRAuthPickerViewController` and
213213
customize it to your needs. Provide `FIRAuthUI` with an instance of your
@@ -227,3 +227,85 @@ func authPickerViewController(for authUI: FIRAuthUI) -> FIRAuthPickerViewControl
227227
return [[CustomAuthPickerViewController alloc] initWithAuthUI:authUI];
228228
}
229229
```
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

Comments
 (0)