If you want to make it possible for your users to access content in Litmos without having to log in directly via your Litmos login page, then you can achieve this by using the Litmos API.
In order to make it happen you will have to follow these steps:
- Make a GET request to the Litmos API for a given user
- Redirect the users browser to the url provided in LoginKey field of response from step 1.
Note:
- The LoginKey changes everytime it is used so don’t store it anywhere. You need to make a fresh request for every login.
- If you create the user via the API and you don't want them to set their own password ever you need to add the<SkipFirstLogin>true</SkipFirstLogin> item to your create user request.
How to get a unique Litmos User Id
Every user in Litmos has a unique id that will not change regardless of whether or not they change their email address which is what they usually login using.
To make life easier we suggest that you store the unique user id in your own system so that you don't have to first GET the user id before each call.
To get all of the users in your account you can make a call to GET /users which will provide a list of users including their id’s.
eg.
GET https://api.litmos.com/v1.svc/users?source=sampleapp
<Users> <User> <Id>abc12345678</Id> <UserName>rich_demo@litmos.com</UserName> <FirstName>Rich</FirstName> <LastName>Chetwynd</LastName> </User> <User> <Id>81818ajsajh</Id> <UserName> dan_demo@litmos.com</UserName> <FirstName> Dan</FirstName> <LastName> Allen</LastName> </User> </Users>
If you want to get back one specific user then use the search variable in your querystring.
eg.
GET https://api.litmos.com/v1.svc/users?source=sampleapp&search=rich@litmos.com
<Users> <User> <Id>abc12345678</Id> <UserName>rich_demo@litmos.com</UserName> <FirstName>Rich</FirstName> <LastName>Chetwynd</LastName> </User> </Users>
How to get a User's LoginKey
Once you have the User Id that you want to login with, you need to make a GET request to /users/{user-id} or /users/{username} which will return information about the user. Included in this API call is a LoginKey which you can use to redirect the users browser to.
eg.
GET https://api.litmos.com/v1.svc/users/abc12345678?source=sampleapp
<User> <Id>abc12345678</Id> <UserName>rich_demo@litmos.com</UserName> <FirstName>Rich</FirstName> <LastName>Chetwynd</LastName> ..... <LoginKey>https://demo.litmos.com/login.aspx?loginkey=xxxzzzyyy777222</LoginKey> </User>
To ensure that a user logging into Litmos by LoginKey never accesses the page that allows for password and profile setup, add the parameter &skipFirstLogin=true to the LoginKey string. This will ensure that the user skips the account/welcome page, where this information can be edited.
***This is different from changing the SkipFirstLogin>true</SkipFirstLogin>element in the request body of an API call. This is a parameter that is appended to the LoginKey string itself.***
e.g. https://demo.litmos.com/login.aspx?loginkey=xxxzzzyyy777222&skipFirstLogin=true
Removing the logout button
To hide the standard title bar you can append the querystring parameter &titlebar=false to the LoginKey i.e https://demo.litmos.com/login.aspx?loginkey=xxxzzzyyy777222&titlebar=false
Please note: the &titlebar=false querystring parameter will only remove the title bar for vertical navigation, accounts setup with horizontal navigation will not be able to use this parameter as the title bar is required to navigate to the learner dashboard.
Log straight into a Course or Learning Path index/landing page
You can do a single sign on and then redirect the learner straight to a Course's or Learning Path's index/landing page rather than just to the generic learner home page. To do this you need to append a querystring key named “C” or "LP" to the SSO login url. The value for “C” or "LP" will be the Original Id for the Course or Learning Path.
You can find the Original Id for a Course or Learning Path by making a call to GET /courses or GET /learningpaths
Ex:
Course: https://domain.litmos.com/login.aspx?loginkey=xxxzzzyyy777222&C=123456
Learning Path: https://domain.litmos.com/login.aspx?loginkey=xxxzzzyyy777222&LP=678910
Single Sign on through SAML
Single sign on through SAML uses SAML 2.0 protocol and currently is only IdP initiated, meaning all SAML requests must come from a website outside of Litmos. See the article(s)on using Litmos with Okta and Azure and ADFS for more information.
Comments
0 comments
Article is closed for comments.