Authentication challenge on standard perspective login

I've tried to use onAuthChallengeCompleted, when logging in on default identity provider. This does not seem to work. Can anyone guide me through this?

My goal is to redirect users to specific url/page, depending on their roles.

Please provide more details on how exactly you have everything set up, and provide some more specifics on what you have checked so far. Is the handler not being called? Is the system not logging the user in? Are you getting errors in the gateway logs? How are you triggering the login?

Are you actually calling an authentication challenge (system.perspective.authenticationChallenge) or do you just have the users using a normal login button/action? If using the latter, the authentication challenge handler is not called.