Deep-link into a course with SAML

Take advantage of the RelayState query param to redirect users to a specific page, or any other page in Litmos after a user has been authenticated. In order to utilize this functionality, please ensure your browser has JavaScript enabled.

In order to take advantage of this approach, your IdP must pass the RelayState parameter along with the rest of the SAML assertion. If you are unsure whether your IdP is passing the RelayState, check the URL address bar to confirm it is still present in the address bar after signing into your IdP, but before being redirected to Litmos.

The RelayState parameter must be appended to your Litmos IdP login URL. By itself, this URL will take you to the IdP sign in page where you will be asked to sign in using your AD credentials, and once authenticated will send you into Litmos. An example RelayState link can be seen below:

https://IdP-sign-in.your-idp.com/saml/idp/litmos?RelayState=https://domain.litmos.com?c=12345

As seen in the example, the link above is compiled of two separate URL’s, brought together using the query parameter. First, we have the specific IdP URL in green where we specify Litmos’ sign in URL from the IdP. Again, this URL by itself should sign you into Litmos. The second portion highlighted in red notes the URL we want the user to be redirected into, once they are signed in.

Lastly, you will need the following JavaScript added to your Litmos account to reload the page with the RelayState as the target URL.

<script type="text/javascript">
$("#page-body").ready(
function() {
var referrerurl = document.referrer;
if (referrerurl.search("RelayState") > -1){
var redirecturl = referrerurl.split("RelayState=");
window.location.href = redirecturl[1];
}
});
</script>

To place the JavaScript into your account, please follow these steps:

Sign in as an Account Owner to your Litmos account.
Click the wrench icon to access “Account” settings
From your Account settings, click “Theme” and scroll down to “Custom Footer”.
Check the box “Show Custom Footer” to enable your custom footer.
Scroll down and click “Save”.

Next time you access a deep link URL with a RelayState, your page will reload with the target URL after being authenticated to Litmos.

 

 

Have more questions? Submit a request

0 Comments

Article is closed for comments.