Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Fetch new access tokens if refreshing token returns "invalid_grant" #1729
I know the PR says to open an issue first, but I figured this could be the discussion as I've already done part of the work.
At my current workplace we have an oauth server with access tokens on a 5 min TTL and refresh tokens on a 30 min TTL. So every so often I'll see the following message.
It's rather annoying to have to go into the OAuth page to clear the tokens and refresh it again. Given Insomnia automatically handles fetching the access / refresh. I'm sure it should be able to ignore this and fetch new tokens if it encounters this error.
So, as per the oauth spec here, I've updated the refreshToken function to return the magic response that will trigger a new token to be fetched if the server sends back
I'm not sure how to go about testing this, so if you want test point me in the right direction and I'll take a shot.