Auth0 Home Blog Docs

Silent Auth fails EXCEPT in incognito mode

This has come up in other posts, but apparently (?) has never been solved. I am using auth0-spa-js and trying to copy as much code from tutorials as possible. So this is not a production app (I’m using localhost, etc.).

Authentication works fine, but I get logged out on page reload. This shows up in the log as a ‘failed silent authentication’. Otherwise, the log isn’t that helpful. Here’s an example:

{
"date": "2019-11-21T21:32:26.218Z",
"type": "fsa",
"description": "Login required",
"client_id": "REDACTED",
"client_name": "PushkinClean",
"ip": "136.167.198.8",
"user_agent": "Safari 13.0.3 / Mac OS X 10.13.6",
"details": {
"body": {},
"qs": {
"client_id": "REDACTED",
"redirect_uri": "http://localhost:3000",
"scope": "openid profile email",
"response_type": "code",
"response_mode": "web_message",
"state": "REDACTED",
"nonce": "REDACTED",
"code_challenge": "REDACTED",
"code_challenge_method": "S256",
"prompt": "none",
"auth0Client": "REDACTED"
},
"connection": null,
"error": {
"message": "Login required",
"oauthError": "login_required",
"type": "oauth-authorization"
}
},
"hostname": "gameswithwords.auth0.com",
"audience": "https://gameswithwords.auth0.com/userinfo",
"scope": [
"openid",
"profile",
"email"
],
"auth0_client": {
"name": "auth0-spa-js",
"version": "1.5.0"
},
"log_id": "90020191121213227535000946672260117689986887469431259234",
"_id": "90020191121213227535000946672260117689986887469431259234",
"isMobile": false
}

Strangely, everything works fine in Incognito mode (in Chrome) or private mode (in Safari). Here is a successful silent authentication:

{
"date": "2019-11-21T21:33:27.269Z",
"type": "ssa",
"client_id": "REDACTED",
"client_name": "PushkinClean",
"ip": "136.167.198.8",
"user_agent": "Safari 13.0.3 / Mac OS X 10.13.6",
"details": {
"prompts": [],
"completedAt": 1574372007268,
"elapsedTime": null,
"session_id": "_OoC-L8xZWNEuMwjq3zTMbkxnFiQl4ac",
"device_id": "v0:7b9072b0-0ca6-11ea-926c-2beb52363114"
},
"hostname": "gameswithwords.auth0.com",
"session_connection": "google-oauth2",
"user_id": "google-oauth2|REDACTED",
"user_name": "REDACTED@gmail.com",
"auth0_client": {
"name": "auth0-spa-js",
"version": "1.5.0"
},
"log_id": "90020191121213331535000103189984026966847535937623162962",
"_id": "90020191121213331535000103189984026966847535937623162962",
"isMobile": false,
"description": "Successful silent authentication"
}

Any ideas as to what might be going on?

In case someone was going to suggest this: I tried clearing my browser cache and cookies. That didn’t work.

Solution(ish) here.

1 Like

Thanks a lot for sharing it with the rest of community!