Get a new token issue

Hello I have a problem. I’m trying to get a new token after the token I already had expired in my SPA. The problem is the endpoint returns the following error:

{
    "error": "access_denied",
    "error_description": "Cannot read property 'audience' of undefined"
}

I already have the refresh token rotation activated and I checked that my custom rules were not causing conflicts.

EDIT. This is my payload when I execute getTokenSilently:

  "client_id": "###",
  "grant_type": "refresh_token",
  "refresh_token": "####",
  "redirect_uri": "http://127.0.0.1:3000/authorize"
}```

Hey there @luis.ponce1 welcome to the community!

Which SPA SDK are you using in particular? What happens if you don’t pass any params and just call getTokenSilently? Are you using authorizationParams?

Keep us posted!

1 Like

Hello, thanks for the welcome and for answering.

I am using @auth0/auth0-spa-js. The issue that I describe in the post is the same when using getTokenSilently I pass authorizationParams to it or not. It’s also worth mentioning that I try to run getTokenSilently before and after the token expires, and the result is the same.

Thanks for confirming @luis.ponce1 ! Are you able to decode the initial access token at jwt.io?

I have seen similar issues arise when there is a misconfiguration causing 2 separate /authorize requests to run at the same time - Similar to what is described here:

3 Likes

Hi @tyf , apologies for the absence. These last few days I had little time to follow up on this bug and focused on other features. I want to tell you that yesterday I found the solution. It turns out that the problem was in the bad configuration of some custom rules, as I read in the solution of this other post:

Thank you very much for your help.

1 Like

Hey @luis.ponce1 no problem, happy to help! Thanks for following up here :pray:

2 Likes

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