Assistance with Custom Authentication API and Role-Based User Redirection

Hello everyone,
I am currently developing an internal CRM and have chosen Retool to expedite the process. However, I am encountering a challenge with integrating a custom authentication flow using Node.js, Express, and JWT.

Implementation Details:

Custom Authentication API: I have developed an authentication API using Node.js and Express. This API validates user credentials against our database and generates a JWT if the credentials are valid. The JWT includes user roles as part of its payload.
Role-Based Redirection: Based on the user role provided in the JWT, I intend to redirect users to different parts of the application. Each role corresponds to a specific set of functionalities and interfaces within the CRM.


I am struggling to integrate this custom authentication process with Retool. Specifically, I need assistance on how to:

Ensure that Retool can correctly parse the JWT to extract user roles.
Redirect users to appropriate applications or interfaces within Retool based on their role as defined in the JWT.

What I've Tried:

I configured Retool to use the JWT for authentication, but I am unsure how to set up role-based redirection within the Retool environment.
I have looked through the Retool documentation but did not find specific instructions related to dynamic redirection based on JWT claims.
Could you provide guidance or examples on how to achieve this within Retool? Any best practices or additional steps I should follow would also be greatly appreciated.

In order for you to parse the JWT token and get the roles you can simply use a J's library for that.
From there you can create different onSuccess modules that open multiple apps accordingly.

The problem with this approach is that won't be able to actually generate authenticated requests in a secure way, because you store the JWT in the frontend and not in retool resources as intended

Can you guide me more on this approach it will be very helpful.