This article explains how to set up OIDC authentication with Auth0 and map Auth0 roles to groups in Qlik Cloud.
This customization is provided as is. Qlik Support cannot provide continued support of the solution. For assistance, reach out to our Professional Services or engage in our active Integrations forum.
Environment
Qlik Cloud
Auth0 Setup
- Create a single page application
Example:
Note down Client ID and Client Secret
- Add your Qlik Cloud tenant callback URL (original tenant URL) in the allowed Callback URLs, which should be https://<tenanturl>.<region>.qlikcloud.com/login/callback
- Scroll to the Advanced Settings section
- Open Endpoints and copy the OpenID configuration endpoint
- On the menu on the left, go to Actions > Library
- Create a new custom action of type Login/Post Login and use the below code:
exports.onExecutePostLogin = async (event, api) => {
const namespace = 'https://my-app.example.com';
if (event.authorization) {
api.idToken.setCustomClaim(`${namespace}/roles`, event.authorization.roles);
api.accessToken.setCustomClaim(`${namespace}/roles`, event.authorization.roles);
api.user.setUserMetadata(`${namespace}/roles`, event.authorization.roles);
}
}
- Click Deploy to activate the action.
This action will pass the user roles in Auth0 to be used as groups in Qlik Cloud.
Qlik Cloud Setup
- Set up a new OIDC Identity Provider and provider Auth0
- In the OpenID configuration field, add the endpoint copied in the previous step 3 of your Auth0 configuration
- Fill in the Client ID and Client secret copied in the previous step 2 of your Auth0 configuration
- For the claims mapping, set the groups to "https://my-app.example.com/roles", adjust other settings based on your needs or leave as default
- Make sure that Override email verified to true is checked and that scope is openid profile email
- Save the settings and go through the validation procedure before activating the Identity Provider