Add group synchronization app in the Auth0 identity management

Relevant Products

Client-side authentication is available in pro print pro mfp

To synchronize groups from Auth0, you must create a group synchronization application in the Auth0 identity platform.

Creating a Regular Web Application in Auth0

  1. Log in to Auth0 identity platform and go to Applications > Applications.

    image2023-4-18_15-20-11.png
  2. Click Create Application.

  3. Enter the name of the application.

  4. In Choose an application type, select Regular Web Applications.

    image2023-3-27_15-31-44.png
  5. Click Create.

  6. Go to the Settings tab.

    image2023-4-18_15-17-29.png


    Domain – The domain used for authentication. This is common for all your applications. 
    Client ID – The ID of the application. 
    Client Secret– The client secret of the application. 

  7. Go to Advanced settings > Grant Types.

    image2023-3-28_7-36-2.png
  8. Make sure that the following grants are selected:

    • Authorization Code

    • Refresh Token

    • Client Credentials

  9. Go to Applications > APIs.

    image2023-3-29_12-19-31.png
  10. Select the API you want your newly created application to access.

  11. Go to to Machine to Machine Applications tab and find your newly created application. Authorize it, and in Permissions, select read:roles.
    image2023-4-18_15-4-5.png

Adding user roles into the JWT token

  1. In Auth0 Identity platform, go to Actions > Library > Custom.

  2. Click Build Custom.

    image2023-3-28_8-0-49.png
  3. Enter the Action name.

  4. In Trigger, select Login / Post Login.

  5. In Runtime, select Node 16.

  6. Click Create.

  7. An editor will be displayed.

    image2023-4-18_15-11-41.png
  8. Paste the following block of code and click Deploy.

    exports.onExecutePostLogin = async (event, api) => {
      const namespace = 'SAFEQ Cloud';
      if (event.authorization) {
        api.idToken.setCustomClaim(`${namespace}/roles`, event.authorization.roles);
        api.accessToken.setCustomClaim(`${namespace}/roles`, event.authorization.roles);
      }
    };
    
  9. Go to Actions > Flows > Login.

    image2023-4-18_15-14-23.png
  10. Drag and drop newly created Action to Login flow.

  11. Click Apply.