Skip to content

Commit ae93621

Browse files
Light copy edit to README
1 parent 18596d1 commit ae93621

File tree

1 file changed

+47
-44
lines changed

1 file changed

+47
-44
lines changed

FirebaseAuthUI/README.md

Lines changed: 47 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,18 @@ bindings on top of [Firebase](https://firebase.google.com) SDKs to eliminate
55
boilerplate code and promote best practices.
66

77
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).
1011

1112
The FirebaseUI Auth component implement best practices for authentication on
1213
mobile devices and websites, which can maximize sign-in and sign-up conversion
1314
for your app. It also handles edge cases like account recovery and account
1415
linking that can be security sensitive and error-prone to handle correctly.
1516

1617
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.
1920

2021
Compatible FirebaseUI clients are also available for [Android](https://github.com/firebase/firebaseui-android/tree/master/auth)
2122
and [Web](https://github.com/firebase/firebaseui-web/).
@@ -52,7 +53,7 @@ instance. The `FUIAuth` instance associated with the default `FIRAuth`
5253
instance can be accessed as follows:
5354

5455
```swift
55-
// swift
56+
// Swift
5657
import Firebase
5758
import FirebaseAuthUI
5859

@@ -65,7 +66,7 @@ authUI?.delegate = self
6566
```
6667

6768
```objective-c
68-
// objc
69+
// Objective-C
6970
@import Firebase;
7071
@import FirebaseAuthUI;
7172
...
@@ -78,7 +79,7 @@ authUI.delegate = self;
7879
This instance can then be configured with the providers you wish to support:
7980

8081
```swift
81-
// swift
82+
// Swift
8283
import FirebaseGoogleAuthUI
8384
import FirebaseFacebookAuthUI
8485
import FirebaseTwitterAuthUI
@@ -92,7 +93,7 @@ self.authUI?.providers = providers
9293
```
9394

9495
```objective-c
95-
// objc
96+
// Objective-C
9697
@import FirebaseGoogleAuthUI;
9798
@import FirebaseFacebookAuthUI;
9899
@import FirebaseTwitterAuthUI;
@@ -105,18 +106,18 @@ NSArray<id<FUIAuthProvider>> *providers = @[
105106
_authUI.providers = providers;
106107
```
107108

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
109110
(step 1 of the [implement Google Sign-In documentation](https://developers.google.com/firebase/docs/auth/ios/google-signin#2_implement_google_sign-in)).
110111

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).
114115

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.
117118

118119
```swift
119-
// swift
120+
// Swift
120121
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any]) -> Bool {
121122
let sourceApplication = options[UIApplicationOpenURLOptionsKey.sourceApplication] as! String?
122123
if FUIAuth.defaultAuthUI()?.handleOpen(url, sourceApplication: sourceApplication) ?? false {
@@ -128,7 +129,7 @@ func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpe
128129
```
129130

130131
```objective-c
131-
// objc
132+
// Objective-C
132133
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary *)options {
133134
NSString *sourceApplication = options[UIApplicationOpenURLOptionsSourceApplicationKey];
134135
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
144145
present the `authViewController` obtain as instance as follows:
145146

146147
```swift
147-
// swift
148+
// Swift
148149

149150
// Present the auth view controller and then implement the sign in callback.
150151
let authViewController = authUI!.authViewController()
@@ -155,7 +156,7 @@ func authUI(_ authUI: FUIAuth, didSignInWith user: FIRUser?, error: Error?) {
155156
```
156157

157158
```objective-c
158-
// objc
159+
// Objective-C
159160
UINavigationController *authViewController = [authUI authViewController];
160161
// Use authViewController as your root view controller,
161162
// or present it on top of an existing view controller.
@@ -166,36 +167,36 @@ UINavigationController *authViewController = [authUI authViewController];
166167
```
167168

168169
## Customizing FirebaseUI for authentication
169-
### Terms of Service (ToS) URL customization:
170+
### Custom terms of Service (ToS) URL
170171

171172
The Terms of Service URL for your application, which is displayed on the
172173
email/password account creation screen, can be specified as follows:
173174

174175
```swift
175-
// swift
176+
// Swift
176177
let kFirebaseTermsOfService = URL(string: "https://firebase.google.com/terms/")!
177178
authUI?.tosurl = kFirebaseTermsOfService
178179
```
179180

180181
```objective-c
181-
// objc
182+
// Objective-C
182183
authUI.TOSURL = [NSURL URLWithString:@"https://example.com/tos"];
183184
```
184185
185186
### Custom strings
186187
187188
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.
189190
190191
In order to do so:
191192
192193
```swift
193-
// swift
194+
// Swift
194195
authUI?.customStringsBundle = NSBundle.mainBundle() // Or any custom bundle.
195196
```
196197

197198
```objective-c
198-
// objc
199+
// Objective-C
199200
authUI.customStringsBundle = [NSBundle mainBundle]; // Or any custom bundle.
200201
```
201202

@@ -215,34 +216,35 @@ subclass by implementing the delegate method
215216
`authPickerViewControllerForAuthUI:` as follows:
216217

217218
```swift
218-
// swift
219+
// Swift
219220
func authPickerViewController(for authUI: FUIAuth) -> FUIAuthPickerViewController {
220221
return CustomAuthPickerViewController(authUI: authUI)
221222
}
222223
```
223224

224225
```objective-c
225-
// objc
226+
// Objective-C
226227
- (FUIAuthPickerViewController *)authPickerViewControllerForAuthUI:(FUIAuth *)authUI {
227228
return [[CustomAuthPickerViewController alloc] initWithAuthUI:authUI];
228229
}
229230
```
230231

231-
### Custom Email Identity provider screens
232+
### Custom email/password screens
232233

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`
237238
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
241242

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:
244246
```swift
245-
// swift
247+
// Swift
246248
func emailEntryViewController(for authUI: FUIAuth) -> FUIEmailEntryViewController {
247249
return CustomEmailEntryViewController(authUI: authUI)
248250
}
@@ -262,11 +264,10 @@ func passwordRecoveryViewController(for authUI: FUIAuth, email: String) -> FUIPa
262264
func passwordVerificationViewController(for authUI: FUIAuth, email: String, newCredential: FIRAuthCredential) -> FUIPasswordVerificationViewController {
263265
return CustomPasswordVerificationViewController(authUI: authUI, email: email, newCredential: newCredential)
264266
}
265-
266267
```
267268

268269
```objective-c
269-
// objc
270+
// Objective-C
270271
- (FUIEmailEntryViewController *)emailEntryViewControllerForAuthUI:(FUIAuth *)authUI {
271272
return [[CustomEmailEntryViewController alloc] initWithAuthUI:authUI];
272273

@@ -290,7 +291,7 @@ func passwordVerificationViewController(for authUI: FUIAuth, email: String, newC
290291
email:(NSString *)email {
291292
return [[CustomPasswordRecoveryViewController alloc] initWithAuthUI:authUI
292293
email:email];
293-
294+
294295
}
295296

296297
- (FUIPasswordVerificationViewController *)passwordVerificationViewControllerForAuthUI:(FUIAuth *)authUI
@@ -302,10 +303,12 @@ func passwordVerificationViewController(for authUI: FUIAuth, email: String, newC
302303
}
303304
```
304305

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`
308310
- `- (void)onBack;`
309311
- `- (void)cancelAuthorization;`
310312

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

Comments
 (0)