This is the problem when I try to receive an access token from 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={}}
I want to keep it as general as possible so I don't want to use the GithubTokenResponse
class. What options do I have left to avoid the exception ?
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
"Ugly" solution :
GitHubTokenResponse tk = oAuthClient.accessToken(request, GitHubTokenResponse.class);