これはgithubからアクセストークンを受け取ろうとすると問題になります。Apache Oltu unsupported_response_type
OAuthProblemException{error='unsupported_response_type', description='Invalid response! Response body is not application/json encoded', uri='null', state='null', scope='null', redirectUri='null', responseStatus=0, parameters={}}
私はGithubTokenResponse
クラスを使用したくないので、可能な限り一般として、それを維持したいです。例外を避けるために残した選択肢は何ですか?
OAuthClient oAuthClient = new OAuthClient(new URLConnectionClient());
OAuthClientRequest request = OAuthClientRequest
.tokenLocation("https://github.com/login/oauth/access_token")
.setCode(code)
.setGrantType(GrantType.AUTHORIZATION_CODE)
.setClientId(id)
.setClientSecret(secret)
.buildQueryMessage();
OAuthAccessTokenResponse tk = oAuthClient.accessToken(request); //this causes the problem
"醜い" 解決策:
GitHubTokenResponse tk = oAuthClient.accessToken(request, GitHubTokenResponse.class);