Skip to content
Switch branches/tags

Lock + SmartLock

CI Status License Maven Central Download

Auth0 is an authentication broker that supports social identity providers as well as enterprise identity providers such as Active Directory, LDAP, Google Apps and Salesforce.

Auth0 Lock integration with Google Smart Lock for Android


Android API level 14+ and Google Play Services 7.5.+


Lock + SmartLock is available both in Maven Central and JCenter. To start using it add this line to your build.gradle dependencies file:

compile ''

Next we're going to configure Auth0 Lock & Google's Smart Lock

###Auth0 Lock

Once it's installed, you'll need to configure LockActivity in yourAndroidManifest.xml, inside the application tag:

<!--Auth0 Lock-->
    <action android:name="android.intent.action.VIEW"/>
    <category android:name="android.intent.category.DEFAULT"/>
    <category android:name="android.intent.category.BROWSABLE"/>
    <data android:scheme="a0INSERT_YOUR_APP_CLIENT_ID" android:host="@string/auth0_domain"/>
<meta-data android:name="com.auth0.lock.client-id" android:value="@string/auth0_client_id"/>
<meta-data android:name="com.auth0.lock.domain-url" android:value="@string/auth0_domain"/>
<!--Auth0 Lock End-->

The value @string/auth0_client_id is your application's clientID and @string/auth0_domain is your tenant's domain in Auth0, both values can be found in your app's settings. The final value of android:scheme must be in lowercase

Also you'll need to add the following permission:

<uses-permission android:name="android.permission.INTERNET"/>

Finally, Make your Application class implement the interface com.auth0.lock.LockProvider and create a SmartLock instance:

public class MyApplication extends Application implements LockProvider {

    private SmartLock lock;

    public void onCreate() {
        lock = new SmartLock.Builder(this)
            /** Other configuration goes here */

    public Lock getLock() {
        return lock;

For more information about configuration options for Lock, please go to Lock repo

###Smart Lock configuration

To enable your application to access Smart Lock, you need to register your application in Google Developers Console by creating a project and registering your keystore SHA1 fingerprint.

We recoomend following Google's Getting Started Guide

Once you have registered your app just add this to your android manifest:

<meta-data android:name="" android:value="@integer/google_play_services_version" />


From any Activity just override the following methods that will allow Lock to interact with Smart Lock

protected void onStart() {

protected void onStop() {

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    SmartLock.getSmartLock(this).onActivityResult(this, requestCode, resultCode, data);

Then register the following BroadcastReceiver to be notified when the user is authenticated

private BroadcastReceiver authenticationReceiver = new BroadcastReceiver() {
    public void onReceive(Context context, Intent intent) {
        UserProfile profile = intent.getParcelableExtra("profile");
        Token token = intent.getParcelableExtra("token");
        // Handle user's credentials

protected void onCreate(Bundle savedInstanceState) {
    broadcastManager = LocalBroadcastManager.getInstance(this);
    broadcastManager.registerReceiver(authenticationReceiver, new IntentFilter(Lock.AUTHENTICATION_ACTION));

protected void onDestroy() {

And to login, just call this method


Issue Reporting

If you have found a bug or if you have a feature request, please report them at this repository issues section. Please do not report security vulnerabilities on the public GitHub issue tracker. The Responsible Disclosure Program details the procedure for disclosing security issues.

What is Auth0?

Auth0 helps you to:

  • Add authentication with multiple authentication sources, either social like Google, Facebook, Microsoft Account, LinkedIn, GitHub, Twitter, Box, Salesforce, amont others, or enterprise identity systems like Windows Azure AD, Google Apps, Active Directory, ADFS or any SAML Identity Provider.
  • Add authentication through more traditional username/password databases.
  • Add support for linking different user accounts with the same user.
  • Support for generating signed Json Web Tokens to call your APIs and flow the user identity securely.
  • Analytics of how, when and where users are logging in.
  • Pull data from other sources and add it to the user profile, through JavaScript rules.

Create a free account in Auth0

  1. Go to Auth0 and click Sign Up.
  2. Use Google, GitHub or Microsoft Account to login.




Lock is available under the MIT license. See the LICENSE file for more info.


Google Smart Lock support for Auth0 Lock




No packages published