Ionic Customizing Lock

Sample Project

Download this sample project configured with your Auth0 API Keys.

System Requirements
  • Ionic 1.3.1
Show requirements

Using Lock is easy, but you may want to customize your login UI. There are several options available for this.

Lock Options

Some UI customization can be done via the options parameter when initializing a lockProvider.

Theme Options

You can set custom theme properties, such as a different logo or primary color, by adding a theme property with custom values:

// www/app.js

(function () {
  ...
  function config($stateProvider, $urlRouterProvider, lockProvider, jwtOptionsProvider) {
    ...
    lockProvider.init({
      clientID: AUTH0_CLIENT_ID,
      domain: AUTH0_DOMAIN,
      options: {
        auth: {
          redirect: false,
          params: {
            scope: 'openid',
            device: 'Mobile device'
          }
        },
        theme: {
          logo: 'https://auth0.com/lib/homepage/img/logo-tmz.svg',
          primaryColor: "#b81b1c"
        }
      }
    });
  });
  ...
})();

NOTE: For more information, see the theming options.

Language Dictionary Specification

You can also customize the text that Lock will display with the languageDictionary option parameter:

// www/app.js

(function () {
  ...
  function config($stateProvider, $urlRouterProvider, lockProvider, jwtOptionsProvider) {
    ...
    lockProvider.init({
      clientID: AUTH0_CLIENT_ID,
      domain: AUTH0_DOMAIN,
      options: {
        auth: {
          redirect: false,
          params: {
            scope: 'openid',
            device: 'Mobile device'
          }
        },
        languageDictionary: {
          title: "Log me in"
        }
      }
    });
  });
  ...
})();

NOTE: For more information, see the Language Dictionary Specification.

This is how Lock will appear using a custom logo, color, and title:

Mobile example screenshot
Use Auth0 for FREECreate free Account