Auth0 Home Blog Docs

getUser fails immediately after login

When a user logs-in via the loginWithRedirect() method of auth0-spa-js, and returns to the callback URL, handleRedirectCallback() is processed successfully, but subsequent calls to getUser() return undefined and isAuthenticated() returns false. The Auth0 Hosted Logs show an error entitled “Failed Silent Auth”:

{
  "date": "2019-09-22T18:54:07.091Z",
  "type": "fsa",
  "description": "Login required",
  "client_id": "...",
  "client_name": "...",
  "ip": "...",
  "user_agent": "Safari 13.0.1 / Mac OS X 10.15.0",
  "details": {
    "body": {},
    "qs": {
      "client_id": "...",
      "scope": "openid profile email",
      "response_type": "code",
      "response_mode": "web_message",
      "state": "...",
      "nonce": "...",
      "redirect_uri": "...",
      "code_challenge": "",
      "code_challenge_method": "S256",
      "prompt": "none",
      "auth0Client": "..."
    },
    "connection": null,
    "error": {
      "message": "Login required",
      "oauthError": "login_required",
      "type": "oauth-authorization"
    }
  },
  "hostname": "...",
  "audience": "https://HOSTNAME/userinfo",
  "scope": [
    "openid",
    "profile",
    "email"
  ],
  "auth0_client": {
    "name": "auth0-spa-js",
    "version": "1.2.3"
  },
  "isMobile": false
}

I followed these instructions for loginWithRedirect(), handleRedirectCallback(), and getUser(): https://auth0.com/docs/libraries/auth0-spa-js

I’m got one step further: I chained the getUser() call after the handleRedirectCallback() promise, and now I’m able to load the user profile on the same page. But if the user refreshes the page, the login information is lost.

I think this is related to https://auth0.com/docs/api-auth/token-renewal-in-safari

I’ll try to setup a custom domain and see if that helps :crossed_fingers:.

Thanks a lot! Let us know what happens!

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