-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EDR token refresh implementation is inconsistent and deviates from the documentation #1565
Comments
This issue is stale because it has been open for 4 weeks with no activity. |
This issue was closed because it has been inactive for 14 days since being marked as stale. |
@ndr-brt : Thanks for reopening. |
could your report the error you are getting? like status code/response message/stacktraces? |
HTTP error 415 unsupported media type is returned on
(1.) (2.) |
I think there are two issue here. One is the unsupported media type which was fixed in 0.7.3. The other issue is to use form body instead of query params which is a breaking change if we suddenly switch If we want to solve this we should guarantee backward compatibility |
Right, that's why I wrote to keep the issue until the first major release of EDC. As discussed already, the linked documentation requests x-www-form-urlencoded body. |
Describe the bug
On API consumer side, the method TokenRefreshHandlerImpl.createTokenRefreshRequest() adds the "Content-Type" header "application/x-www-form-urlencoded" to the token refresh request, but adds the parameters "grant_type" and "refresh_token" as query parameters of the URL rather than as urlencoded body.
On API provider side, the method TokenRefreshApiController.refreshToken() also adds the parameters as query parameters.
The corresponding documention correctly adds these parameters as urlencoded body in the HTTP request.
To Reproduce
Adding the "Content-Type" header "application/x-www-form-urlencoded", which describes the format of the HTTP body, and providing a zero-length HTTP body is inconsistent. The implementation also deviates from the documentation. Additionally, this leads to an incompatibility between EDC 0.7.2 and 0.7.3 when refreshing the EDR token, which is why we found this issue.
Expected behavior
Either send/receive the parameters as urlencoded body or remove the "Content-Type" header "application/x-www-form-urlencoded" and adapt the documentation. As tokens tend to be long and different environments may have different restrictions regarding URL length, it's probably the better idea to urlencode the parameters in the body as defined in the documentation.
Screenshots/Error Messages
N/A
Context Information
Please be aware, that fixing this according to either of the proposals mentioned as expected behavior again breaks the EDR token refresh. So, best is to keep this as a known issue until the first major release of Tractus-X EDC.
Possible Implementation
Use URLEncoder.
The text was updated successfully, but these errors were encountered: