@@ -41,20 +41,20 @@ Firebase: see the
4141Then, add the FirebaseUI auth library dependency. If your project uses
4242Gradle, add:
4343
44- ```
44+ ``` groovy
4545dependencies {
4646 // ...
47- compile 'com.firebaseui:firebase-ui-auth:0.5.1 '
47+ compile 'com.firebaseui:firebase-ui-auth:0.5.3 '
4848}
4949```
5050
5151If instead your project uses Maven, add:
5252
53- ```
53+ ``` xml
5454<dependency >
5555 <groupId >com.firebaseui</groupId >
5656 <artifactId >firebase-ui-auth</artifactId >
57- <version>0.5.1 </version>
57+ <version >0.5.3 </version >
5858</dependency >
5959```
6060
@@ -70,7 +70,7 @@ If support for Facebook Sign-in is also required, define the
7070resource string ` facebook_application_id ` to match the application ID in
7171the [ Facebook developer dashboard] ( https://developers.facebook.com ) :
7272
73- ```
73+ ``` xml
7474<resources >
7575 <!-- ... -->
7676 <string name =" facebook_application_id" translatable =" false" >APPID</string >
@@ -95,7 +95,7 @@ Before invoking the FirebaseUI authentication flow, your app should check
9595whether a
9696[ user is already signed in] ( https://firebase.google.com/docs/auth/android/manage-users#get_the_currently_signed-in_user ) from a previous session:
9797
98- ```
98+ ``` java
9999FirebaseAuth auth = FirebaseAuth . getInstance();
100100if (auth. getCurrentUser() != null ) {
101101 // already signed in
@@ -127,15 +127,15 @@ The builder provides the following customization options for the authentication
127127 a link in the small-print of the account creation step for new users. If no
128128 terms of service URL is provided, the associated small-print is omitted.
129129
130- - A custom theme can specified for the flow, which is applied to all the
130+ - A custom theme can be specified for the flow, which is applied to all the
131131 activities in the flow for consistent customization of colors and typography.
132132
133133#### Sign-in examples
134134
135135If no customization is required, and only email authentication is required, the sign-in flow
136136can be started as follows:
137137
138- ```
138+ ``` java
139139startActivityForResult(
140140 // Get an instance of AuthUI based on the default app
141141 AuthUI . getInstance(). createSignInIntentBuilder(). build(),
@@ -145,7 +145,7 @@ startActivityForResult(
145145You can enable sign-in providers like Google Sign-In or Facebook Log In by calling the
146146` setProviders ` method:
147147
148- ```
148+ ``` java
149149startActivityForResult(
150150 AuthUI . getInstance()
151151 .createSignInIntentBuilder()
@@ -159,7 +159,7 @@ startActivityForResult(
159159
160160If a terms of service URL and a custom theme are required:
161161
162- ```
162+ ``` java
163163startActivityForResult(
164164 AuthUI . getInstance()
165165 .createSignInIntentBuilder()
@@ -176,7 +176,7 @@ Using SmartLock is recommended to provide the best user experience, but in some
176176to disable SmartLock for testing or development. To disable SmartLock, you can use the
177177` setIsSmartLockEnabled ` method when building your sign-in Intent:
178178
179- ```
179+ ``` java
180180startActivityForResult(
181181 AuthUI . getInstance()
182182 .createSignInIntentBuilder()
@@ -188,7 +188,7 @@ startActivityForResult(
188188It is often desirable to disable SmartLock in development but enable it in production. To achieve
189189this, you can use the ` BuildConfig.DEBUG ` flag to control SmartLock:
190190
191- ```
191+ ``` java
192192startActivityForResult(
193193 AuthUI . getInstance()
194194 .createSignInIntentBuilder()
@@ -206,7 +206,7 @@ typically useful; the only recourse for most apps if sign in fails is to ask
206206the user to sign in again later, or proceed with an anonymous account if
207207supported.
208208
209- ```
209+ ``` java
210210protected void onActivityResult(int requestCode, int resultCode, Intent data) {
211211 super . onActivityResult(requestCode, resultCode, data);
212212 if (requestCode == RC_SIGN_IN ) {
@@ -246,7 +246,7 @@ In order to make this process easier, AuthUI provides a simple `signOut` method
246246to encapsulate this behavior. The method returns a ` Task ` which is marked
247247completed once all necessary sign-out operations are completed:
248248
249- ```
249+ ``` java
250250public void onClick(View v) {
251251 if (v. getId() == R . id. sign_out) {
252252 AuthUI . getInstance()
@@ -303,7 +303,7 @@ the flow, a new theme can be declared. Standard material design color
303303and typography properties will take effect as expected. For example, to define
304304a green theme:
305305
306- ```
306+ ``` xml
307307<style name =" GreenTheme" parent =" FirebaseUI" >
308308 <item name =" colorPrimary" >@color/material_green_500</item >
309309 <item name =" colorPrimaryDark" >@color/material_green_700</item >
@@ -317,7 +317,7 @@ a green theme:
317317
318318With associated colors:
319319
320- ```
320+ ``` xml
321321<color name =" material_green_50" >#E8F5E9</color >
322322<color name =" material_green_500" >#4CAF50</color >
323323<color name =" material_green_700" >#388E3C</color >
@@ -328,7 +328,7 @@ With associated colors:
328328
329329This would then be used in the construction of the sign-in intent:
330330
331- ```
331+ ``` java
332332startActivityForResult(
333333 AuthUI . getInstance(this ). createSignInIntentBuilder()
334334 // ...
@@ -344,7 +344,7 @@ easily overridden by name in your application. See
344344[ the built-in strings.xml] ( src/main/res/values/strings.xml ) and simply
345345redefine a string to change it, for example:
346346
347- ```
347+ ``` java
348348< resources>
349349 < ! -- was " Signing up..." -- >
350350 < string name= " progress_dialog_signing_up" > Creating your shiny new account...</string>
@@ -353,24 +353,37 @@ redefine a string to change it, for example:
353353
354354### OAuth Scope Customization
355355
356+ #### Google
357+ By default, FirebaseUI requests the `email` and `profile` scopes when using Google Sign In. If you
358+ would like to request additional scopes from the user, add a string array resource named
359+ `google_permissions` to your `strings.xml` file like this:
360+
361+ ```xml
362+ <!--
363+ For a list of all scopes, see:
364+ https://developers.google.com/identity/protocols/googlescopes
365+ -->
366+ <string-array name="google_permissions">
367+ <!-- Request permission to read the user's Google Drive files -->
368+ <item>https://www.googleapis.com/auth/drive.readonly</item>
369+ </string-array>
370+ ```
371+
372+
356373#### Facebook
357374
358375By default, FirebaseUI requests the `email` and `public_profile` permissions when initiating
359- Facebook Login. If you would like to override these scopes, add a string array resource
360- to your application like this:
376+ Facebook Login. If you would like to override these scopes, a string array resource named
377+ `facebook_permissions` to your `strings.xml` file like this:
361378
362- ```
379+ ```xml
363380<!--
364381 See:
365382 https://developers.facebook.com/docs/facebook-login/android
366383 https://developers.facebook.com/docs/facebook-login/permissions
367384-->
368- <array name="facebook_permissions">
369- <item>public_profile</item>
370- <item>email</item>
371- <!-- ... -->
372- </array>
385+ <string-array name="facebook_permissions">
386+ <!-- Request permission to know the user's birthday -->
387+ <item>user_birthday</item>
388+ </string-array>
373389```
374-
375- Note that if you do not include at least the ` email ` and ` public_profile ` scopes, FirebaseUI
376- will not work properly.
0 commit comments