Route user to different web apps based on Auth0 custom claims value

Requirement:

  1. User is given a gateway web application URL where he continues with the Auth0 Login.
  2. Upon successful authentication, application will read the claims.
    2.1 If claims has ‘admin’ value then application should redirect the user to admin web
    application which is in asp.net mvc.
    2.2 If claims has ‘reader’ value then application should redirect the user to reader web
    application which is react app.
  3. These redirected web applications should just validate the user token with Auth0, save it and then Authorize the user.
  4. If the token expires, user should be redirect to Gateway web application.

PFA Diagram:

Auth_Routing

Hi @dheeraj.awale,

Your use case should be possible. Once the user has fully authenticated and redirects to your callback URL, you can decode the token and then redirect them to your preferred application based on the claims.

You will have to perform a redirect twice.

I hope this helps!

Cheers,
Rueben

Thanks @rueben.tiow , I am able to redirect (twice). But I am not able to figure out how to validate (or revalidate) the token in preferred application without having user to re-challenge the auth0.
Can you please give me some direction on ‘how to JUST validate the token I received form Auth code flow?’

Hi @dheeraj.awale,

Thanks for the reply.

Sure! You can validate the access token by using any third-party libraries from JWT.io.

Please refer to our Validate JSON Web Tokens documentation for more information.

Thanks,
Rueben

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.