@@ -5,17 +5,18 @@ bindings on top of [Firebase](https://firebase.google.com) SDKs to eliminate
5
5
boilerplate code and promote best practices.
6
6
7
7
FirebaseUI provides a drop-in auth solution that handles the UI flows for
8
- signing in users with email addresses and passwords, Google Sign-In, and
9
- Facebook Login. It is built on top of [ Firebase Auth] ( https://firebase.google.com/docs/auth ) .
8
+ signing in users with email addresses and passwords, and federated identity
9
+ providers such as Google Sign-In and Facebook Login. It is built on top of
10
+ [ Firebase Auth] ( https://firebase.google.com/docs/auth ) .
10
11
11
12
The FirebaseUI Auth component implement best practices for authentication on
12
13
mobile devices and websites, which can maximize sign-in and sign-up conversion
13
14
for your app. It also handles edge cases like account recovery and account
14
15
linking that can be security sensitive and error-prone to handle correctly.
15
16
16
17
FirebaseUI can be easily customized to fit in with the rest of your app's visual
17
- style, and it is open source, so you aren't constrained in realizing the user
18
- experience you want.
18
+ style, and it is open source, so you aren't constrained in realizing the user
19
+ experience you want.
19
20
20
21
Compatible FirebaseUI clients are also available for [ Android] ( https://github.com/firebase/firebaseui-android/tree/master/auth )
21
22
and [ Web] ( https://github.com/firebase/firebaseui-web/ ) .
@@ -52,7 +53,7 @@ instance. The `FUIAuth` instance associated with the default `FIRAuth`
52
53
instance can be accessed as follows:
53
54
54
55
``` swift
55
- // swift
56
+ // Swift
56
57
import Firebase
57
58
import FirebaseAuthUI
58
59
@@ -65,7 +66,7 @@ authUI?.delegate = self
65
66
```
66
67
67
68
``` objective-c
68
- // objc
69
+ // Objective-C
69
70
@import Firebase;
70
71
@import FirebaseAuthUI;
71
72
...
@@ -78,7 +79,7 @@ authUI.delegate = self;
78
79
This instance can then be configured with the providers you wish to support:
79
80
80
81
``` swift
81
- // swift
82
+ // Swift
82
83
import FirebaseGoogleAuthUI
83
84
import FirebaseFacebookAuthUI
84
85
import FirebaseTwitterAuthUI
@@ -92,7 +93,7 @@ self.authUI?.providers = providers
92
93
```
93
94
94
95
``` objective-c
95
- // objc
96
+ // Objective-C
96
97
@import FirebaseGoogleAuthUI;
97
98
@import FirebaseFacebookAuthUI;
98
99
@import FirebaseTwitterAuthUI;
@@ -105,18 +106,18 @@ NSArray<id<FUIAuthProvider>> *providers = @[
105
106
_authUI.providers = providers;
106
107
```
107
108
108
- For Google sign in support, add custom URL schemes to your Xcode project
109
+ For Google Sign- in support, add custom URL schemes to your Xcode project
109
110
(step 1 of the [ implement Google Sign-In documentation] ( https://developers.google.com/firebase/docs/auth/ios/google-signin#2_implement_google_sign-in ) ).
110
111
111
- For Facebook sign in support, follow step 3 and 4 of
112
- [ Facebook login documentation] ( https://developers.google.com/firebase/docs/auth/ios/facebook-login#before_you_begin )
113
- , and add custom URL schemes following step 5 of [ Facebook SDK for iOS-Getting started documentation] ( https://developers.facebook.com/docs/ios/getting-started ) .
112
+ For Facebook Login support, follow step 3 and 4 of
113
+ [ Facebook login documentation] ( https://developers.google.com/firebase/docs/auth/ios/facebook-login#before_you_begin ) ,
114
+ and add custom URL schemes following step 5 of [ Facebook SDK for iOS-Getting started documentation] ( https://developers.facebook.com/docs/ios/getting-started ) .
114
115
115
- Finally add a call to handle the URL that your application receives at the end of the
116
- Google/Facebook authentication process.
116
+ Finally, add a call to handle the URL that your application receives at the end
117
+ of the Google/Facebook authentication process.
117
118
118
119
``` swift
119
- // swift
120
+ // Swift
120
121
func application (_ app : UIApplication, open url : URL, options : [UIApplicationOpenURLOptionsKey : Any ]) -> Bool {
121
122
let sourceApplication = options[UIApplicationOpenURLOptionsKey.sourceApplication ] as! String ?
122
123
if FUIAuth.defaultAuthUI ()? .handleOpen (url, sourceApplication : sourceApplication) ?? false {
@@ -128,7 +129,7 @@ func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpe
128
129
```
129
130
130
131
``` objective-c
131
- // objc
132
+ // Objective-C
132
133
- (BOOL )application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary *)options {
133
134
NSString * sourceApplication = options[ UIApplicationOpenURLOptionsSourceApplicationKey] ;
134
135
return [[ FUIAuth defaultAuthUI] handleOpenURL: url sourceApplication: sourceApplication ] ;
@@ -144,7 +145,7 @@ app or present it from another view controller within your app. In order to
144
145
present the ` authViewController ` obtain as instance as follows:
145
146
146
147
``` swift
147
- // swift
148
+ // Swift
148
149
149
150
// Present the auth view controller and then implement the sign in callback.
150
151
let authViewController = authUI! .authViewController ()
@@ -155,7 +156,7 @@ func authUI(_ authUI: FUIAuth, didSignInWith user: FIRUser?, error: Error?) {
155
156
```
156
157
157
158
``` objective-c
158
- // objc
159
+ // Objective-C
159
160
UINavigationController *authViewController = [authUI authViewController ];
160
161
// Use authViewController as your root view controller,
161
162
// or present it on top of an existing view controller.
@@ -166,36 +167,36 @@ UINavigationController *authViewController = [authUI authViewController];
166
167
```
167
168
168
169
## Customizing FirebaseUI for authentication
169
- ### Terms of Service (ToS) URL customization:
170
+ ### Custom terms of Service (ToS) URL
170
171
171
172
The Terms of Service URL for your application, which is displayed on the
172
173
email/password account creation screen, can be specified as follows:
173
174
174
175
``` swift
175
- // swift
176
+ // Swift
176
177
let kFirebaseTermsOfService = URL (string : " https://firebase.google.com/terms/" )!
177
178
authUI? .tosurl = kFirebaseTermsOfService
178
179
```
179
180
180
181
``` objective-c
181
- // objc
182
+ // Objective-C
182
183
authUI.TOSURL = [NSURL URLWithString: @"https://example.com/tos" ] ;
183
184
```
184
185
185
186
### Custom strings
186
187
187
188
You can override the default messages and prompts shown to your users. This can
188
- be useful for things such as adding support for other languages besides English.
189
+ be useful for things such as adding support for languages other than English.
189
190
190
191
In order to do so:
191
192
192
193
```swift
193
- // swift
194
+ // Swift
194
195
authUI?.customStringsBundle = NSBundle.mainBundle() // Or any custom bundle.
195
196
```
196
197
197
198
``` objective-c
198
- // objc
199
+ // Objective-C
199
200
authUI.customStringsBundle = [NSBundle mainBundle ]; // Or any custom bundle.
200
201
```
201
202
@@ -215,34 +216,35 @@ subclass by implementing the delegate method
215
216
` authPickerViewControllerForAuthUI: ` as follows:
216
217
217
218
``` swift
218
- // swift
219
+ // Swift
219
220
func authPickerViewController (for authUI : FUIAuth) -> FUIAuthPickerViewController {
220
221
return CustomAuthPickerViewController (authUI : authUI)
221
222
}
222
223
```
223
224
224
225
``` objective-c
225
- // objc
226
+ // Objective-C
226
227
- (FUIAuthPickerViewController *)authPickerViewControllerForAuthUI:(FUIAuth *)authUI {
227
228
return [[ CustomAuthPickerViewController alloc] initWithAuthUI: authUI ] ;
228
229
}
229
230
```
230
231
231
- ### Custom Email Identity provider screens
232
+ ### Custom email/password screens
232
233
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 ` )
234
+ You can customize all email/password screens, including but not limited to:
235
+ - Hiding the top ` UINavigationBar `
236
+ - Adding a ` Cancel ` button
237
+ - Use a UI view other than ` UITableView `
237
238
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)
239
+ - ` UIAlertController ` popups (showing error labels instead)
240
+ - Modifying the screen flow (combining screens or skipping particular screens)
241
+ - Disabling validation, including email validation
241
242
242
- In order to achieve email provider screen customization, create subclass of appropriate controller and implement it to your needs. Provide ` FUIAuth ` with an instance of your
243
- subclass by implementing the delegate methods:
243
+ To customize the email/password screens, create a subclass of appropriate
244
+ controller and implement it to your needs. Then set up ` FUIAuth ` with an
245
+ instance of your subclass by implementing the following delegate methods:
244
246
``` swift
245
- // swift
247
+ // Swift
246
248
func emailEntryViewController (for authUI : FUIAuth) -> FUIEmailEntryViewController {
247
249
return CustomEmailEntryViewController (authUI : authUI)
248
250
}
@@ -262,11 +264,10 @@ func passwordRecoveryViewController(for authUI: FUIAuth, email: String) -> FUIPa
262
264
func passwordVerificationViewController (for authUI : FUIAuth, email : String , newCredential : FIRAuthCredential) -> FUIPasswordVerificationViewController {
263
265
return CustomPasswordVerificationViewController (authUI : authUI, email : email, newCredential : newCredential)
264
266
}
265
-
266
267
```
267
268
268
269
``` objective-c
269
- // objc
270
+ // Objective-C
270
271
- (FUIEmailEntryViewController *)emailEntryViewControllerForAuthUI:(FUIAuth *)authUI {
271
272
return [[ CustomEmailEntryViewController alloc] initWithAuthUI: authUI ] ;
272
273
@@ -290,7 +291,7 @@ func passwordVerificationViewController(for authUI: FUIAuth, email: String, newC
290
291
email:(NSString *)email {
291
292
return [[ CustomPasswordRecoveryViewController alloc] initWithAuthUI: authUI
292
293
email: email ] ;
293
-
294
+
294
295
}
295
296
296
297
- (FUIPasswordVerificationViewController *)passwordVerificationViewControllerForAuthUI:(FUIAuth *)authUI
@@ -302,10 +303,12 @@ func passwordVerificationViewController(for authUI: FUIAuth, email: String, newC
302
303
}
303
304
```
304
305
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;
306
+ In your custom view controllers, call the same FirebaseUI methods as their
307
+ parent classes. For example:
308
+ - ` - (void)onNext:(NSString *)textFieldValue; // Or any action that leads to the next screen `
309
+ - ` - (void)didChangeTextField:(NSString *)textFieldValue; // Usually called in viewWillAppear and after modification of text entry field `
308
310
- ` - (void)onBack; `
309
311
- ` - (void)cancelAuthorization; `
310
312
311
- You can refer to objective-c and swift samples to see how customization can be achieved.
313
+ Refer to the Objective-C and Swift samples for examples of how you can customize
314
+ these views.
0 commit comments