@@ -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.2 '
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.2 </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 >
@@ -83,7 +83,7 @@ Before invoking the FirebaseUI authentication flow, your app should check
8383whether a
8484[ user is already signed in] ( https://firebase.google.com/docs/auth/android/manage-users#get_the_currently_signed-in_user ) from a previous session:
8585
86- ```
86+ ``` java
8787FirebaseAuth auth = FirebaseAuth . getInstance();
8888if (auth. getCurrentUser() != null ) {
8989 // already signed in
@@ -123,7 +123,7 @@ The builder provides the following customization options for the authentication
123123If no customization is required, and only email authentication is required, the sign-in flow
124124can be started as follows:
125125
126- ```
126+ ``` java
127127startActivityForResult(
128128 // Get an instance of AuthUI based on the default app
129129 AuthUI . getInstance(). createSignInIntentBuilder(). build(),
@@ -133,7 +133,7 @@ startActivityForResult(
133133You can enable sign-in providers like Google Sign-In or Facebook Log In by calling the
134134` setProviders ` method:
135135
136- ```
136+ ``` java
137137startActivityForResult(
138138 AuthUI . getInstance()
139139 .createSignInIntentBuilder()
@@ -147,7 +147,7 @@ startActivityForResult(
147147
148148If a terms of service URL and a custom theme are required:
149149
150- ```
150+ ``` java
151151startActivityForResult(
152152 AuthUI . getInstance()
153153 .createSignInIntentBuilder()
@@ -164,7 +164,7 @@ Using SmartLock is recommended to provide the best user experience, but in some
164164to disable SmartLock for testing or development. To disable SmartLock, you can use the
165165` setIsSmartLockEnabled ` method when building your sign-in Intent:
166166
167- ```
167+ ``` java
168168startActivityForResult(
169169 AuthUI . getInstance()
170170 .createSignInIntentBuilder()
@@ -176,7 +176,7 @@ startActivityForResult(
176176It is often desirable to disable SmartLock in development but enable it in production. To achieve
177177this, you can use the ` BuildConfig.DEBUG ` flag to control SmartLock:
178178
179- ```
179+ ``` java
180180startActivityForResult(
181181 AuthUI . getInstance()
182182 .createSignInIntentBuilder()
@@ -194,7 +194,7 @@ typically useful; the only recourse for most apps if sign in fails is to ask
194194the user to sign in again later, or proceed with an anonymous account if
195195supported.
196196
197- ```
197+ ``` java
198198protected void onActivityResult(int requestCode, int resultCode, Intent data) {
199199 super . onActivityResult(requestCode, resultCode, data);
200200 if (requestCode == RC_SIGN_IN ) {
@@ -234,7 +234,7 @@ In order to make this process easier, AuthUI provides a simple `signOut` method
234234to encapsulate this behavior. The method returns a ` Task ` which is marked
235235completed once all necessary sign-out operations are completed:
236236
237- ```
237+ ``` java
238238public void onClick(View v) {
239239 if (v. getId() == R . id. sign_out) {
240240 AuthUI . getInstance()
@@ -265,7 +265,7 @@ the flow, a new theme can be declared. Standard material design color
265265and typography properties will take effect as expected. For example, to define
266266a green theme:
267267
268- ```
268+ ``` xml
269269<style name =" GreenTheme" parent =" FirebaseUI" >
270270 <item name =" colorPrimary" >@color/material_green_500</item >
271271 <item name =" colorPrimaryDark" >@color/material_green_700</item >
@@ -279,7 +279,7 @@ a green theme:
279279
280280With associated colors:
281281
282- ```
282+ ``` xml
283283<color name =" material_green_50" >#E8F5E9</color >
284284<color name =" material_green_500" >#4CAF50</color >
285285<color name =" material_green_700" >#388E3C</color >
@@ -290,7 +290,7 @@ With associated colors:
290290
291291This would then be used in the construction of the sign-in intent:
292292
293- ```
293+ ``` java
294294startActivityForResult(
295295 AuthUI . getInstance(this ). createSignInIntentBuilder()
296296 // ...
@@ -306,7 +306,7 @@ easily overridden by name in your application. See
306306[ the built-in strings.xml] ( src/main/res/values/strings.xml ) and simply
307307redefine a string to change it, for example:
308308
309- ```
309+ ``` java
310310< resources>
311311 < ! -- was " Signing up..." -- >
312312 < string name= " progress_dialog_signing_up" > Creating your shiny new account...</string>
@@ -315,24 +315,37 @@ redefine a string to change it, for example:
315315
316316### OAuth Scope Customization
317317
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+
318335#### Facebook
319336
320337By 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:
323340
324- ```
341+ ```xml
325342<!--
326343 See:
327344 https://developers.facebook.com/docs/facebook-login/android
328345 https://developers.facebook.com/docs/facebook-login/permissions
329346-->
330347<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>
334350</array>
335351```
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