You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the JDKHttpClient uses the following Accept header, if none is specified by the calling code: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
As described in a JDK issue [1], this causes problems with several server side libraries.
I had problems to get the device authorization flow working with Keycloak due to this issue.
What worked for me was extending OAuth20Service, and overriding the execute methods, and patching the request like that: request.addHeader("Accept", "*/*");
The accept header */* is used per default by Postman and curl, so it seems to be a meaningful default - at least better than html, image and so on (afaik, scribejava is mostly dealing with JSON).
I would suggest to change method JDKHttpClient#prepareConnectionForBodyAndGetOutputStream to set this meaningful default Accept header, if none has been already set. [2]
Currently the JDKHttpClient uses the following Accept header, if none is specified by the calling code:
text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
As described in a JDK issue [1], this causes problems with several server side libraries.
I had problems to get the device authorization flow working with Keycloak due to this issue.
What worked for me was extending OAuth20Service, and overriding the execute methods, and patching the request like that:
request.addHeader("Accept", "*/*")
;The accept header
*/*
is used per default by Postman and curl, so it seems to be a meaningful default - at least better than html, image and so on (afaik, scribejava is mostly dealing with JSON).I would suggest to change method
JDKHttpClient#prepareConnectionForBodyAndGetOutputStream
to set this meaningful default Accept header, if none has been already set. [2][1] https://bugs.openjdk.org/browse/JDK-8163921
[2]
scribejava/scribejava-core/src/main/java/com/github/scribejava/core/httpclient/jdk/JDKHttpClient.java
Line 224 in 49cf8a6
The text was updated successfully, but these errors were encountered: