Exceeded reuse of refresh token #52488
Replies: 3 comments 4 replies
-
This is not a refresh token expiry issue, but a restriction on a number of times it can be used, as far as I recall, advanced client configuration in the Keycloak dashboard allows to configure it. I'd expect a user re-authentication redirect in this case, is it what you are seeing ? There is also an option to redirect a user to a session expired page, with something like In general, you can also catch
If the refresh token is in a JWT format, it can check its expiry time, if it has expired, a re-authentication is initiated
There could be concurrent requests, Quarkus just forwards refresh requests to Keycloak, or what do you mean by |
Beta Was this translation helpful? Give feedback.
-
|
Thanks a lot for your input @sberyozkin!
Unfortunately we don't know what the user experiences, but since we don't hear complaints, we suspect that the redirect is already in place.
This would certainly be a way to suppress the error message, but would feel more like a workaround than a solution.
Does that mean Quarkus does check the expiry time or could it check the time? Maybe there is some kind of configuration that we did not set?
I think it could be very well possible, that the frontend, that uses this quarkus application, is calling multiple endpoints in the same session simultaneously. For example: Keycloak is configured to only use refresh tokens once and then invalidate them. One call uses the refresh token and the refresh token is therefore invalidated. Another, simultaneous call uses the same (now invalidated) refresh token and gets "invalid_grant".
Yes, but i don't have control over the keycloak server (barely know its configuration). I suspect the RT reuse is 1 and this causes problems with quarkus. |
Beta Was this translation helpful? Give feedback.
-
|
By the way, what exactly is the end goal, avoid a user re-authentication altogether ? The issue we are discussing here may cause a new reauthentication indeed, perhaps more frequently than expected, but overall, ultimately, the user will eventually have to re-authenticate in any case, for ex, when the RT actually does expire in 6 hours. As suggested above, if the main concern is a user experience, for example, an authenitcated user is accessing some custom portal and now suddenly sees a Keycloak login screen due to a token refresh failing that can indeed be quite unexpected, then IMHO the best way to handle is to register a custom session expired page and it will keep it pleasant for users when dealing with such situations - this is what I see every day when going to my airline etc - I'm in a session and then I'm told the session has expired, and I have an option to relogin |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I received the following message in my quarkus application:
Now i got three questions that could help me here:
invalid_grant-Error gracefully? It looks like the refresh token is not valid anymore (it is only valid 6 hours) and it might be, that this error is expected.Beta Was this translation helpful? Give feedback.
All reactions