Widget UI: Redirecting after successful login

Hi,

I’m having an issue redirecting to my application after a successful login. I’m looking at the following page of documentation:

And I’ve tried the following code snippet:

lock = new Auth0Lock(
    AUTH_LOCK_KEY,
    AUTH_DOMAIN,
    {
        container: "login-content",
        allowedConnections: "Username-Password-Authentication"],
        auth: {
            responseType: "token",
            params: {
                state: {
                    "return_url": "http://localhost:9000/admin/test"
                }
            }
        },
        socialButtonStyle: "big",
        languageDictionary: {"title":"Auth0"},
        language: "en",
        theme: {"primaryColor":"#3A99D8"}
    }
);

My goal here is to redirect the user to “http://localhost:9000/admin/test” after successfully logging in, but the above options do not provide this functionality.

Can anyone point out what I may be doing wrong?

Thanks,

-Mikey

That redirect option is useful if you want to have dynamic redirect URL’s which you have not configured in the Allowed Callback URLs client setting. If you will always be redirecting back to a pre-known page, you can do the following:

  1. Add the url http://localhost:9000/admin/test to your Allowed Callback URLs in the Client settings.
  2. Set the redirectUrl parameter in Lock:
    Lock Configuration Options