token not refreshing when switching environments

Bug
This bug has been introduced by upgrading to 2025.5.0, this was all working as expected yesterday on 2025.5.0.
Using authentication in folder settings > OAuth 2 > Client Credentials.
If I make a request in Env1 the token is correctly fetched and applied to my requests.
When I change to Env2, all my requests now fail with 401 Unauthorized
If I delete the token from folder settings > OAuth 2, then a new token is generated and my requests work.
Decoding the token, I can see that the token available after in Env2 immediately after switching from Env1 and making a new request is still using the clientId from Env1.
Linux2025.5.0
*working on 2025.4.0
Oops, commented on the wrong feedback. I’ll be fixing this as well though
Ah, I think I see the problem. There was a bug in the last version that caused the token always be refetched on every new request.
I’m fixing it now so that tokens are keyed by clientId/authUrl/tokenUrl
Alright, in 2025.5.2 the stored tokens are now stored as a combined key of clientId/tokenUrl/authorizationUrl so I think this should work for you.
Amazing, can confirm this is fixed in 2025.5.2.
Thanks for the quick turn around!
Awesome, thanks for the quick reply! Now I can go to bed in peace :)
@Greg Schier I’ve a similar issue, but not when switching workspaces, when the token expires, it’s not auto-refreshing. I’m using the workspace settings for it and I have to delete the token and then it’s working again.
I’m on 2025.5.6
Oh interesting. Which grant type are you using? Also, do you see the
expires_infield within the Access Token Response?I’m using Client Credentials grant type and can’t see the
expires_infield in the response.I only see the following fields:
access_tokensignatureinstance_urlidtoken_typeissued_at@Greg Schier this is still an issue, can you maybe have a look at it? Or should I create a new Bug ticket?
Can you create a new one with as much detail as possible?