Submit a ticket My Tickets
Welcome
Login  Sign up
Open navigation

How to Create your Custom SSO Solution

If our build-in SAML or WordPress SSO plugin solutions do not fit your system you may use this guide to implement and use SSO on your Learnworlds school.


The concept is to authenticate school users via an authentication provider that would implement the Single Sign-On mechanism. So the user would be redirected to an external authentication page (that you need to implement based on this guide) and when successfully authenticated, the user would be returned to the school as a logged-in user. 


What you need is a page that the user will be able to:

  • Login - provide email and password to be authenticated in your system.
  • Sign-up - if you wish to allow the users to self sign-up into your system.
  • Password reset - a mechanism that will allow the users to reset their password.

When you set up your SSO, the LearnWorlds platform will redirect the aforementioned user's actions to your custom page. Thus, any links pointing to these forms will be redirected to your HTML page.

The custom page that you will create will need to accept 2 URL parameters:

  • action - with three possible values: login, signup, password reset.
  • redirectUrl - this is the page where the user was before the authentication request. You need to use this parameter to redirect the user after successful authentication in your system.
    Note: The redirectUrl is encoded and will need to be decoded before redirecting the user to the URL.

An example URL that your system might accept is: http://www.example.com/sso-learnworlds?action=login&redirectUrl=https%3A%2F%2Fsoftomotive.getlearnworlds.com%2Fcourse%3Fcourseid%3Dwinautomation-foundation.


The following sections present a more detailed explanation of how to implement each workflow.

Login Workflow

1. User clicks on Sign-in.

2. Learnworlds system redirects to the SSO provider URL with parameters ‘action=login’ and ‘redirectUrl=<current page>’

3. SSO provider opens a login form.

4. User enters their credentials. 

5. If Authenticated correctly, the SSO provider uses the Learnworlds API to perform the following:

a. Use the Learnworlds SSO API method to login the user to Learnworlds school https://docs.learnworlds.com/#sso-with-a-user-39-s-email-or-user-id (this method would also take the redirectUrl to send the user to the school.

b. The aforementioned method returns the Learnworldsuser_id, if the user is new then you would need to store this user_id for future use. Also, you might need to use the user update method (https://docs.learnworlds.com/#update-a-user) to provide more info for the user. 

6. The user is logged in back to the page that they stated. 


Note: It is better to use the Learnworlds User_id to SSO existing users since it is possible to change the email on the SSO Provider platform. 

Sign-up Workflow

The sign-up is always performed on the SSO provider’s platform. 


1. User clicks on Sign-up.

2. Learnworlds system redirects to the SSO provider URL with parameters ‘action=signup’ and ‘redirectUrl=<current page>’.

3. SSO provider opens a sign-up form. 

4. SSO provider finishes registration of the user and triggers the above login mechanism to SSO the user to Learnworlds.

Password Reset Workflow

The sign-up is always performed on the SSO provider’s platform. 


1. User clicks on the password reset button. 

2. Learnworlds system redirects to the SSO provider URL with parameters ‘action=passwordreset’ and ‘redirectUrl=<current page>’ 

3. SSO provider opens a password reset form. 

4. SSO provider finishes password reset workflow and triggers the above login mechanism to SSO the user. 

Set up your SSO URL

Once you have your custom page ready, you may set up your school to use this custom SSO solution. Navigate to Site Builder → Sign-in/up, select the custom URL, enter your custom page’s URL, and press Test Url to validate your implementation.

Click on Save to save the settings, so your users will be now be authenticated via your own custom SSO page. 


Notes:

  • Mechanisms related to authentication would be removed from the LearnWorlds school. For instance, the email and password changing forms found in a user's profile will be removed.
  • The changes in the Sign in/up page regarding SSO will have to be made by the LearnWorlds admin.
  • If you wish to use our build-in Affiliate Management program, you should consider not using the SSO solution, since it will not be feasible to use this feature and track sales.
  • If you're using Custom SSO as an authentication method, it's mandatory to change the Site Navigation settings in the Payment Flow section for Logged-out users, as they will need to sign up/log in before proceeding to the payment page.

  • If you select the Custom SSO solution the password update/reset functionality will not be available. Also, you need to make sure that in all Payment Sections the Sign in/up form option is set to hide since the user will not be able to sign in/up via the Learnworlds system.

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.