Impersonation on Angular App using custom login/signup (auth0 API)

We have an angular app that implements authentication with auth0. We use the following library versions:

"angular": "~1.5.9"

"auth0-angular": "~4.2.6"

"auth0.js": "~6.7"

"angular-jwt": "0.0.9"

We have a custom login/signup UI for which we implemented the auth0 API instead of the lock-widget.
We need to add impersonation for troubleshooting but the dashboard “Sign in as User” doesn’t work out of the box, meaning we are redirected to the frontend app but the login is not performed. This is how we setup the dashboard advanced settings:

Response mode: GET

Response type: token

Scope: openid roles name email scopes offline_access picture (these are the same we use in the option
authParams.scope of the auth.signin() API).

This is the format of redirect url generated for “client side app”: https://dc3education.auth0.com/users/<auth0-id>/impersonate?&bewit=<bewit query param>

We want to perform the impersonation from the auth0 dashboard (not using “Impersonation API” option). We are planning to implement a custom “impersonation” login when the dashboard redirects us to the app but we are not sure what would be the best way to do it. Directions on how to implement this feature would be welcome.

Thanks.

What happens when you try to redirect to the generated URL? It should perform a redirect to your application callback URL with the tokens.

Yes, it does. Our app default state is “login” if a user is not authenticated so when the auth0 impersonation API redirected to the app we would be taken to “login”. For this reason I was never able to notice that the callback URL generated on the auth0 console included “id_token” and “access_token” as query strings. Once I figured that out (with the help of another developer) it all made sense.