これは、github からアクセス トークンを取得しようとしたときに発生する問題です。
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);