Auth0 is a flexible, cloud-based identity platform for developers, allowing them to easily add authentication and authorization services to their applications, eliminating friction and the complexity of APIs and custom development.

Read along to see how you can easily enable Single Sign On for your LearnWorlds school using Auth0.

1 Request access to LearnWorlds Restful API.

If you don’t already have access to our APIs go to My accountPremium Members. And click on the button Request API keys as shown below (available in Learning Center plans and above).

This will trigger a request to our support team and within 1-2 working days your API access will be enabled. Upon that you will receive an email from us informing you of the enabling of the service along with usage examples and credentials including your API endpoint, LearnWorlds Client ID and Client Access Token. Store those two somewhere as you will need them for setting up your Auth0 application.

2Create an Auth0 application.

2.1Access your Auth0 tenant management panel. And visit the applications tab and click on the Create Application button.

2.2In the Create Application modal that will appear enter your application name and select Regular Web Application as the application type and then click Create

2.3Access the Application Settings from the tab.

2.4Set the following variables to your settings:

Application Login URI: 

Allowed Callback URLs:


Allowed Logout URLs:


Allowed Web Origins:


Allowed Origins (CORS):


Use the school API url as provided by the LearnWorlds Support team in the email of step1.

2.5Customize your application. Setup your applications customization options and addons based on your needs. You can follow Auth0's documentation to fully customize every aspect of your users authorization experience.

Setting up different connections:

Branding and Customization:

3Create a new Rule.

3.1Visit the Rules page from the sidebar.

3.2Set settings variables.

Key: lwClientId

Value: The LearnWorlds Client id you received from us

Key: lwApi

Value: The LearnWorlds API endpoint you received from us


Value: The LearnWorlds Client Token you received from us

Key: lwSchoolUri

Value: Your School's domain name ex.

3.3Click on the Create Rule button to create a new Rule and then select the Empty Rule option as shown below


3.4Copy paste the following code snippet and click Save Changes

function (user, context, callback) {

  const axios = require('axios@0.19.2');

  user.user_metadata = user.user_metadata || {};


  const learnWorldsId = user.user_metadata.lwUserId;


  const ssoData = {

    username: user.nickname,

    avatar: user.avatar,


    redirectUrl: `${configuration.lwSchoolUri}/start`



  if (learnWorldsId) {

    ssoData.user_id = learnWorldsId;


  const options = { method: 'POST',

    url: `${configuration.lwApi}/sso`,

    headers: { 

      'content-type': 'application/json',

      'Lw-Client': configuration.lwClientId,

      'Authorization': `Bearer ${configuration.lwClientToken}`


    data: JSON.stringify(ssoData) };


    .then( (res) => {

      if ( {

        user.user_metadata.lwUserId =;

        auth0.users.updateUserMetadata(user.user_id, user.user_metadata)


          context.redirect = {



          return callback(null, user, context);






      else {

        console.error('Could not authorize you to learnworlds.');



    .catch( err => {

      console.error('Could not authorize you to learnworlds');



3.5Make sure that the Rule you just created is prioritized as the last one in case you have more rules for your authorization flow.

4Get In touch with us!

Contact our support team and provide them with your Auth0 application id, tenant id and location as shown below. Then you'll be informed as soon as the integration gets enabled from us.