Hello
I am using Universal Login flow. On production, when the user logs in and gets redirected back, a checkSession poll works fine. Same code on localhost doesn’t work. On localhost, immediately after a successful login and redirection callback, when I try checksession(), it says login_required.
Note the code is exactly the same with one difference i.e. I am using a different tenant and a different client application on localhost.
When I use production’s tenant domain and client ID on localhost, everything works fine again and checkSession call succeeds.
I have checked word by word every field/configuration for the two tenants and applications and I am still unable to spot any difference between the two. What could possibly be going wrong here?
The code and methods used to build and deploy are exactly the same. The only difference is the following constants in dot env files. I will share it below
Open D2 Link and make sure you have debug console open with preserve log enabled
It will take you to sign up on Auth0’s Universal Login page. Use any method to login.
You will be redirected back and few seconds later, amidst various debug statements you will find the error starting with message checkSession error-ed out. It also logs Auth0’s configuration options and response data with it for further investigation.
If you are trying out both environments, D1 and D2, make sure you are using two separate email address.
Key Findings
There are two network errors that stand out from Auth0’s side of things. When you are trying to log in via the hosting login page for D2, you see the following errors. These are not visible in the logs of hosted login page for D1’s tenant. Also, note the errors are on Hosted Login page and not on this application page.
SSO Data 404
client.js:772 GET https://eylocalhost.auth0.com/user/ssodata 404
Google’s /accounts/SetSID:8 errors out with 404
On top of that, user is asked to login again for D2’s tenant within minutes of login.
If the application sends the user to login again on the hosted login page, (for e.g. when the token is expired or deleted from localstorage), D1’s tenant immediately redirects the user back to the callback URL. Although, D2’s tenant shows login prompt to the user.
My Theory
For D2’s tenant, persistent cookies aren’t being set at Auth0’s end and hence it doesn’t recognize a returning user. This results in
failing checkSession
login prompt shown again to a user who logged in just a few minutes ago.
There is some configuration mismatch between D1’s and D2’s tenant for my end. This is unlikely as I have tried creating multiple tenants and application with the same configuration and even creating different application within D1’s tenant and error still remains the same. Please help me figure out what I might be missing.
I wanted to follow up with you @sidle.marketing after talking with our support team. When you get a minute can you confirm in your browser that third-party cookies are enabled? From there can you also check to make sure you are not using the default Auth0 dev keys? Please let me know if this helps solve the challenge you are facing. Thanks!
Thanks @James.Morrison. I was able to figure out the problem after looking into the “Logs” tab on the Dashboard.
The issue was I was using default Google connector. Auth0 logs had a warning about it and on creating a new Google Oauth Client, the problem got solved. This was completely an error on my part. Looking back, a warning about Default Connector on the console might have sped up debugging. Maybe it’s something you can consider. Thanks a lot for your help!