In the previous articles, we have shown how to associate dashboards and (filtered) datasets with an Integration. Now that your Integration has been set up properly in Luzmo, it is time to start building your application.
When embedding your Luzmo dashboards securely in your platform, you will first need to retrieve a SSO authorization token. This SSO token grants temporary access to a specific Integration.
This request for a SSO authorization token should occur in your backend (server-side code). Within this request you can specify certain properties to ensure a multi-tenant setup of your embedded dashboards (setting up your multi-tenancy is discussed in this Academy article). It is at this stage where you specify the role for your users: more information on that below!
After successfully creating your Integration, you will receive a presentation of the necessary backend code from our supported SDKs (more on this below). Simply copy the code presented to you and fill in the necessary fields for an effortless integration!
We provide SDK's for various backend libraries. These SDK's provide a ready-made alternative to having to code 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 do not 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 it should be fairly easy 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 does an action in your platform that would require a SSO token (e.g. navigating to another embedded dashboard). This prevents users running into errors because of tokens that expired due to inactivity!
To facilitate deciding which role you should specify in the authorization request for your user(s), we added below a small flow diagram!
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: 'designer'
});
promise.then(function(result){
// return result.id and result.token to the client
})
In case you are interested in toggling certain features (e.g. exporting, alerting, etc.) for your users, this Academy article will show you all feature flags which you can override on a user-level by specifying them in the SSO authorization request!
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 in your frontend to embed the dashboard and optionally add dashboard designing possibities: this is all neatly explained in our next article.