Redirect user back to login after access deny

Hello,

I’ve implemented a login action to deny user if role is not admin:

if ((event.client.name === "Application Name") && !userRoles.includes("admin"))
    api.access.deny(`Access to ${event.client.name} is not allowed.`);

This works fine and message is displayed on callback. However, if I try to go back to the login screen, I am forced back to the callback (/api/auth/callback?error=access_denied&error_description=). I never see the login page. How do I force the user back to login page to login?

Thanks,
IJ

Hey @imad !

You might want to look into using the api.redirect.sendUserTo() function as outlined here.

Let us know if that does the trick!