Lock Android v1 Native Social Authentication


This document covers an outdated version of Lock for Android. We recommend you to upgrade to v2

This feature relies on a deprecated grant type. Applications created after June 8th 2017 won't be able to use this feature. We recommend using browser-based flows, as explained in Authentication via Universal Login.

Lock by default handles all social authentication with a Browser installed in your Android device, but for some social connections you can take advantage of our native integration. We implemented native integration with Facebook and Google+ and bundled each of them in a separate Android Library (aar file), to start using them just add these lines in your build.gradle:

compile 'com.auth0.android:lock-facebook:2.3.+'
compile 'com.auth0.android:lock-googleplus:2.3.+'



Lock uses Facebook Android SDK to obtain the user's credentials and use them to login with your Auth0 application.

To get started, in your AndroidManifest.xml you need to add the following:

<activity android:name="com.facebook.FacebookActivity"
          android:label="@string/app_name" />
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>

Where @string/facebook_app_id is your Facebook Application ID that you can get from Facebook Dev Site.

For more information please check Facebook Getting Started Guide.

Finally, you need to register Auth0 Facebook Provider with Lock so it can do all Facebook authentication. This can be done in your Application object onCreate method right after you initialise Lock:

public void onCreate() {
    lock = new Lock.Builder()
            .withIdentityProvider(Strategies.Facebook, new FacebookIdentityProvider(this))


For Google login we use Google Signin library that is part of Google Play Services.

Before we start, you'll need to register your application in Google Developers and create a OAuth 2.0 client, to do that follow this wizard

The next step is to configure your Google connection in Auth0 Dashboard with the newly created OAuth 2.0 client information. Just go to Social Connections, select Google and in the field named Allowed Mobile Client IDs add the ID of the OAuth 2.0 client.

Then in your AndroidManifest.xml add these permissions and meta-data value for Google Play Services:

<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />

And finally register Google Identity Provider with Lock in your Application object onCreate:

public void onCreate() {
    lock = new LockBuilder()
            .withIdentityProvider(Strategies.GooglePlus, new GooglePlusIdentityProvider(this))