checkSession call is returning 400 with HTML response

I originally posted this question in oauth 2.0 - Auth0 checkSession call to renew return an HTML error page - Stack Overflow, but I figured it’s better to ask here.

I have a Single Page App using Auth0 Implicit Flow with Silent Authentication. I got the authentication part working just fine, but when I try to implement checkSession method to renew the session in the background (as per Auth0.js v9 Reference), the AJAX call to the auth0.com domain returns a 400 HTML error instead of a JSON one.

webAuth.checkSession({}, function (err, authResult) {
  ...
});

The error is Oops!, something went wrong , which I can see in my browser devtools Network Response tab.

There could be a misconfiguration in the system or a service outage. We track these errors automatically, but if the problem persists feel free to contact us. Please try again.

I am not sure why there would be an HTML response, and not sure what I might be doing wrong. I have added my page’s domain to the “Allowed Web Origins” list on the Auth0 application settings.

Hi @tridnguyen,

Welcome to the Community!

Could you take a look at your Auth0 logs and let me know what error is mentioned?

Let me know,
Dan

Hi @dan.woda, thanks so much for the response!

I did not know I had logs available! But I do!

So the relevant part of the error I see is:

  "description": "The specified redirect_uri 'undefined' does not have a registered origin.",

I didn’t know that I had to specify the redirect_uri parameter in the checkSession call. When I did, it now caused my site to be in a loop.

What did you put as the redirect URI?

My site’s callback URL, the same as what I pass in for the webAuth.authorize() call.

I figured it out I think. The looping was a bad logic on my part.

1 Like

Thanks for following up!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.