client.getTokenSilently always fails

I have several apps using a similar setup.
In my current app getTokenSilently always fails.
In my network tab I see 2 authorize? calls
In my other app I see one authorize call and a token calls
When I use my new config with a previous implementation it also fails.
Really hitting a wall here, hope someone can give me some pointer?

Best, Bas

1 Like

Hi @bbz,

Can you give us some more context, maybe post the code associated with this error?


const client$: Observable<Auth0Client> = defer(() => createAuth0Client(auth0Config())).pipe(shareReplay(1))

export const createClient = () => client$

export enum Status {
  CheckingAuth = 'CheckingAuth',
  Authenticated = 'Authenticated',
  NotAuthenticated = 'NotAuthenticated'

export function useAuthStatus() {
  const [status, setStatus] = useState<Status>(Status.CheckingAuth)
  const dispatch = useDispatch()

  useEffect(() => {
    createClient().subscribe(client => {
      Promise.all([client.getTokenSilently(), client.getUser()])
        .then(([token, userData]) => {
          // this never happens
          dispatch(setLoginSuccess(token, userData))

        .catch(e => {
  }, [])

  return status

Hi Dan, happy to share. Let me know if you need more context.

How is it failing? Are you getting an error of some kind? If you are, can you copy and paste the error here.

error: "login_required"
error_description: "Login required"
state: "d2lHRThLYkVoMGdwRmJ2cGpnbG1DamM5cTdBUHVlbWZhTUVhRGJGUE9SWg=="

Typically this error is signaling that there is no session/cookie to validate and the user must provide credentials to get a new token. This could be an issue with a browser or extension blocking cookies. What browser are you using?

Chrome and Firefox, I’ve read that there are issues with Safari. Is there a way to find out what’s wrong with the session?

1 Like

This is starting to get to me.
I’ve downloaded the React SPA sample code, update my settings.
Same thing I can login but silent authentication always fails

Can you DM me a HAR of the transaction?

You got mail! :sweat_smile:

Okay, I took a look at the HAR. Everything looks normal.

Can you try a few things for me?

  • Try it in an incognito tab
  • Try it on another browser if you have one
  • Finally, if neither of those work, try downloading a quickstart and see if that works okay.
  • Try it in an incognito tab
    The har I sent you was made in incognito
  • Try it on another browser if you have one
    I’ve tried Chrome and Firefox
  • Finally, if neither of those work, try downloading a quickstart and see if that works okay.
    If the quickstart include the React Spa example, I downloaded it and the har was made with that.
    If not do you have a link?
    In the meantime I’ll try and sent you a screen recording

Best, Bas

I see, that’s not possible… any other options?

I know it is unlikely, but have you blocked third party cookies in both browsers?

Do you see any setting I should change?

1 Like

Looks good to me, thanks for showing it.

I used

You can use the management API explorer to update it if you don’t want to write a script.!/Clients/patch_clients_by_id

To update the setting, now it completely works as expected!

1 Like

Thanks for following up!

1 Like

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