Getting "callback url mismatch" using Auth0

I have an Auth0 client configured with the following callback URL:

http: // localhost: 4200

I can log in just fine.

The problem is that I go to a specific URL-address in my application: http://localhost:4200/places. Here's what happens:

  • I turn to http://localhost:4200/places
  • Angular redirects me (correctly) to http://localhost:4200
  • I'm trying to log in
  • I get an error from Auth0: "URL" http: // localhost: 4200 / places "is not in the list of allowed callback URLs."

Auth0 is right, http://localhost:4200/placesnot on my list of allowed callback URLs - and I don't want that to be. I do not want to list any URLs that my user can drop to the login screen.

So for some reason, something happens that tells Auth0 that the link URL http://localhost:4200/placesis not http://localhost:4200, although http://localhost:4200it is actually the URL in the address bar when trying to log in.

I understand that I could specify http://localhost:4200how to redirectUrl"fix" the problem, but then I would have to distinguish redirectUrlfrom dev, staging and production. This does not seem to be the way people usually get around this problem.

How can I make Auth0 not try to redirect me to /places?

+4
2

( , ). window.top.location.origin window.top.location.hostname. window.top.location.origin Auth0.

:

    let stateOptions =
    {
        "auth0_authorize": this.authNonce,
        "return_url": router.url
    };

    let options =
        {
            closable: false,
            languageDictionary:
            {
                emailInputPlaceholder: "something@youremail.com",
                title: "Log me in"
            },
            auth:
            {
                redirectUrl: window.top.location.origin,
                redirect: true,
                responseType: 'token',
                params:
                {
                    state: btoa(JSON.stringify(stateOptions)),
                    scope: 'openid user_id name nickname email picture'
                }
            }
        };

    this.lock = new Auth0Lock('[your-auth0-clientid]', '[your-auth0-domain]', options);
+2

. , Auth0.

enter image description here

. , Auth0 , URL- . , RedirectURL . google. , .

, google , Auth0. .

, .

+1

Source: https://habr.com/ru/post/1662047/


All Articles