In the previous articles, we showed you how to associate dashboards and (filtered) datasets with an Integration. To securely access an embedded Luzmo dashboard in your platform, you will first need to retrieve a SSO authorization token granting temporary access to a specific Integration containing the desired dashboard.
This request for a SSO authorization token should occur in your backend (server-side code). Within this request, you can specify the necessary properties to ensure a multi-tenant setup of your dashboards integration (all multi-tenant setups are discussed in this Academy article). Note the importance of specifying the role for your end-users when creating their SSO tokens: more information on that, below.
After successfully creating your Integration, you will be presented an overview of the necessary backend code in our supported SDK's (more on this below). Copying this code and filling in the necessary fields will make this step effortless!
We provide SDK's for different backend libraries reduce the burden of having to code all the API calls yourself. All SDK's can be found here in our Developer documentation, and you can see the corresponding code examples by using the selectors on the top right of the Developer documentation page.
If we currently don't provide an SDK for your backend library, don't worry: Luzmo's API's all use REST calls with default HTTP verbs and JSON content, and so you should be able to write these calls yourself 😉
In its simplest form (i.e. not providing any properties for a multitenant dashboard setup) you should specify:
There is no limit on the number of SSO tokens that you can request, and so we recommend requesting a SSO token each time the user performs an action in your platform that would require a SSO token (e.g. navigating to another embedded dashboard). This prevents end users running into errors because of tokens that expired due to inactivity!
const Luzmo = require('@luzmo/nodejs-sdk');
var client = new Luzmo({
api_key: '< Your API key >',
api_token: '< Your API token >'
});
let promise = client.create('authorization', {
type: 'sso',
username: '12345678',
suborganization: 'Burrito Co.',
name: 'SSO user',
email : 'sso_user@example.com',
expiry: '24 hours',
inactivity_interval: '10 minutes',
integration_id: '<integration_id>',
role: 'viewer'
});
promise.then(function(result){
// return result.id and result.token to the client
})
As a result, you will receive a temporary SSO authorization token from Luzmo. This is a JSON object with an id/token combination:
{
"type": "sso",
"id": "< the authorization key >",
"token": "< the authorization token >",
"user_id": "< the SSO user id >," // This will stay the same for consecutive SSO authorization requests,
// and it is used on our end to manage user-specific content such as alerts
...
}
The second step is to use this SSO token to embed the dashboard in your frontend, which is explained in our next article.