fosite icon indicating copy to clipboard operation
fosite copied to clipboard

Wrong invalid_request error returned instead of invalid_grand on refresh_token revocation ?

Open thibaultponcelet opened this issue 6 years ago • 2 comments

Describe the bug

When the client uses a revoked/unknown refresh token (https://tools.ietf.org/html/rfc6749#section-6) fosite is returning "invalid_request" fosite.ErrInvalidRequest instead of fosite.ErrInvalidGrant.

To Reproduce

  1. Generate a refresh token
  2. revoke the refresh token
  3. Use the refresh token

Expected behavior

According to https://tools.ietf.org/html/rfc6749#section-5.2, "invalid_grant" should be returned in this case. The "invalid_request" error is too generic and the description isn't mentioning that it could be due to an invalid refresh token, leading to very difficult debugging on the clients side.

Additional context

See https://github.com/ory/fosite/blob/master/handler/oauth2/flow_refresh.go#L68

We could work on a merge request to fix this if you agree with the change.

thibaultponcelet avatar Apr 03 '20 13:04 thibaultponcelet

Right! That would be great! :)

aeneasr avatar Apr 10 '20 10:04 aeneasr

Hey there. I'll start working on it.

damienbr avatar Apr 14 '20 09:04 damienbr