@@ -41,20 +41,20 @@ Firebase: see the
41
41
Then, add the FirebaseUI auth library dependency. If your project uses
42
42
Gradle, add:
43
43
44
- ```
44
+ ``` groovy
45
45
dependencies {
46
46
// ...
47
- compile 'com.firebaseui:firebase-ui-auth:0.5.1 '
47
+ compile 'com.firebaseui:firebase-ui-auth:0.5.2 '
48
48
}
49
49
```
50
50
51
51
If instead your project uses Maven, add:
52
52
53
- ```
53
+ ``` xml
54
54
<dependency >
55
55
<groupId >com.firebaseui</groupId >
56
56
<artifactId >firebase-ui-auth</artifactId >
57
- <version>0.5.1 </version>
57
+ <version >0.5.2 </version >
58
58
</dependency >
59
59
```
60
60
@@ -70,7 +70,7 @@ If support for Facebook Sign-in is also required, define the
70
70
resource string ` facebook_application_id ` to match the application ID in
71
71
the [ Facebook developer dashboard] ( https://developers.facebook.com ) :
72
72
73
- ```
73
+ ``` xml
74
74
<resources >
75
75
<!-- ... -->
76
76
<string name =" facebook_application_id" translatable =" false" >APPID</string >
@@ -83,7 +83,7 @@ Before invoking the FirebaseUI authentication flow, your app should check
83
83
whether a
84
84
[ user is already signed in] ( https://firebase.google.com/docs/auth/android/manage-users#get_the_currently_signed-in_user ) from a previous session:
85
85
86
- ```
86
+ ``` java
87
87
FirebaseAuth auth = FirebaseAuth . getInstance();
88
88
if (auth. getCurrentUser() != null ) {
89
89
// already signed in
@@ -123,7 +123,7 @@ The builder provides the following customization options for the authentication
123
123
If no customization is required, and only email authentication is required, the sign-in flow
124
124
can be started as follows:
125
125
126
- ```
126
+ ``` java
127
127
startActivityForResult(
128
128
// Get an instance of AuthUI based on the default app
129
129
AuthUI . getInstance(). createSignInIntentBuilder(). build(),
@@ -133,7 +133,7 @@ startActivityForResult(
133
133
You can enable sign-in providers like Google Sign-In or Facebook Log In by calling the
134
134
` setProviders ` method:
135
135
136
- ```
136
+ ``` java
137
137
startActivityForResult(
138
138
AuthUI . getInstance()
139
139
.createSignInIntentBuilder()
@@ -147,7 +147,7 @@ startActivityForResult(
147
147
148
148
If a terms of service URL and a custom theme are required:
149
149
150
- ```
150
+ ``` java
151
151
startActivityForResult(
152
152
AuthUI . getInstance()
153
153
.createSignInIntentBuilder()
@@ -164,7 +164,7 @@ Using SmartLock is recommended to provide the best user experience, but in some
164
164
to disable SmartLock for testing or development. To disable SmartLock, you can use the
165
165
` setIsSmartLockEnabled ` method when building your sign-in Intent:
166
166
167
- ```
167
+ ``` java
168
168
startActivityForResult(
169
169
AuthUI . getInstance()
170
170
.createSignInIntentBuilder()
@@ -176,7 +176,7 @@ startActivityForResult(
176
176
It is often desirable to disable SmartLock in development but enable it in production. To achieve
177
177
this, you can use the ` BuildConfig.DEBUG ` flag to control SmartLock:
178
178
179
- ```
179
+ ``` java
180
180
startActivityForResult(
181
181
AuthUI . getInstance()
182
182
.createSignInIntentBuilder()
@@ -194,7 +194,7 @@ typically useful; the only recourse for most apps if sign in fails is to ask
194
194
the user to sign in again later, or proceed with an anonymous account if
195
195
supported.
196
196
197
- ```
197
+ ``` java
198
198
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
199
199
super . onActivityResult(requestCode, resultCode, data);
200
200
if (requestCode == RC_SIGN_IN ) {
@@ -234,7 +234,7 @@ In order to make this process easier, AuthUI provides a simple `signOut` method
234
234
to encapsulate this behavior. The method returns a ` Task ` which is marked
235
235
completed once all necessary sign-out operations are completed:
236
236
237
- ```
237
+ ``` java
238
238
public void onClick(View v) {
239
239
if (v. getId() == R . id. sign_out) {
240
240
AuthUI . getInstance()
@@ -265,7 +265,7 @@ the flow, a new theme can be declared. Standard material design color
265
265
and typography properties will take effect as expected. For example, to define
266
266
a green theme:
267
267
268
- ```
268
+ ``` xml
269
269
<style name =" GreenTheme" parent =" FirebaseUI" >
270
270
<item name =" colorPrimary" >@color/material_green_500</item >
271
271
<item name =" colorPrimaryDark" >@color/material_green_700</item >
@@ -279,7 +279,7 @@ a green theme:
279
279
280
280
With associated colors:
281
281
282
- ```
282
+ ``` xml
283
283
<color name =" material_green_50" >#E8F5E9</color >
284
284
<color name =" material_green_500" >#4CAF50</color >
285
285
<color name =" material_green_700" >#388E3C</color >
@@ -290,7 +290,7 @@ With associated colors:
290
290
291
291
This would then be used in the construction of the sign-in intent:
292
292
293
- ```
293
+ ``` java
294
294
startActivityForResult(
295
295
AuthUI . getInstance(this ). createSignInIntentBuilder()
296
296
// ...
@@ -306,7 +306,7 @@ easily overridden by name in your application. See
306
306
[ the built-in strings.xml] ( src/main/res/values/strings.xml ) and simply
307
307
redefine a string to change it, for example:
308
308
309
- ```
309
+ ``` java
310
310
< resources>
311
311
< ! -- was " Signing up..." -- >
312
312
< string name= " progress_dialog_signing_up" > Creating your shiny new account...</string>
@@ -315,24 +315,37 @@ redefine a string to change it, for example:
315
315
316
316
### OAuth Scope Customization
317
317
318
+ #### Google
319
+ By default, FirebaseUI requests the `email` and `profile` scopes when using Google Sign In. If you
320
+ would like to request additional scopes from the user, add a string array resource named
321
+ `google_permissions` to your `strings.xml` file like this:
322
+
323
+ ```xml
324
+ <!--
325
+ For a list of all scopes, see:
326
+ https://developers.google.com/identity/protocols/googlescopes
327
+ -->
328
+ <array name="google_permissions">
329
+ <!-- Request permission to read the user's Google Drive files -->
330
+ <item>https://www.googleapis.com/auth/drive.readonly</item>
331
+ </array>
332
+ ```
333
+
334
+
318
335
#### Facebook
319
336
320
337
By default, FirebaseUI requests the `email` and `public_profile` permissions when initiating
321
- Facebook Login. If you would like to override these scopes, add a string array resource
322
- to your application like this:
338
+ Facebook Login. If you would like to override these scopes, a string array resource named
339
+ `facebook_permissions` to your `strings.xml` file like this:
323
340
324
- ```
341
+ ```xml
325
342
<!--
326
343
See:
327
344
https://developers.facebook.com/docs/facebook-login/android
328
345
https://developers.facebook.com/docs/facebook-login/permissions
329
346
-->
330
347
<array name="facebook_permissions">
331
- <item>public_profile</item>
332
- <item>email</item>
333
- <!-- ... -->
348
+ <!-- Request permission to know the user's birthday -->
349
+ <item>user_birthday</item>
334
350
</array>
335
351
```
336
-
337
- Note that if you do not include at least the ` email ` and ` public_profile ` scopes, FirebaseUI
338
- will not work properly.
0 commit comments