Return-Path: X-Original-To: apmail-oltu-dev-archive@www.apache.org Delivered-To: apmail-oltu-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 30B9A17FDF for ; Tue, 12 May 2015 04:49:00 +0000 (UTC) Received: (qmail 62599 invoked by uid 500); 12 May 2015 04:49:00 -0000 Delivered-To: apmail-oltu-dev-archive@oltu.apache.org Received: (qmail 62557 invoked by uid 500); 12 May 2015 04:49:00 -0000 Mailing-List: contact dev-help@oltu.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@oltu.apache.org Delivered-To: mailing list dev@oltu.apache.org Received: (qmail 62545 invoked by uid 99); 12 May 2015 04:49:00 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 May 2015 04:49:00 +0000 Date: Tue, 12 May 2015 04:48:59 +0000 (UTC) From: "Alistair King (JIRA)" To: dev@oltu.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (OLTU-170) Exception when obtaining access token for LINKED IN MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/OLTU-170?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14539232#comment-14539232 ] Alistair King commented on OLTU-170: ------------------------------------ I intermittently see this error as well. In my case I'm using OLTU as both the client and the server. It appears this error is thrown, regardless of what the actual exception is: {code:title=OAuthClientRegistrationResponse.java|borderStyle=solid} protected void setBody(String body) throws OAuthProblemException { try { this.body = body; parameters = JSONUtils.parseJSON(body); } catch (Throwable e) { throw OAuthProblemException.error(OAuthError.CodeResponse.UNSUPPORTED_RESPONSE_TYPE, "Invalid response! Response body is not application/json encoded"); } } {code} > Exception when obtaining access token for LINKED IN > --------------------------------------------------- > > Key: OLTU-170 > URL: https://issues.apache.org/jira/browse/OLTU-170 > Project: Apache Oltu > Issue Type: Bug > Components: oauth2-client > Affects Versions: oauth2-1.0.0 > Environment: Win7/JDK8.31 > Reporter: Constantin Mitocaru > > After obtaining the code I make this call: > {code} > OAuthClientRequest request = OAuthClientRequest > .tokenProvider(OAuthProviderType.LINKEDIN) > .setGrantType(GrantType.AUTHORIZATION_CODE) > .setClientId(resources.getString("in.app-key")) > .setClientSecret(resources.getString("in.app-secret")) > .setRedirectURI(receivingUrl) > .setCode(code) > .buildQueryMessage(); > String uri = request.getLocationUri(); > System.out.println("IN.uri.auth_token="+uri); > OAuthClient oAuthClient = new OAuthClient(new URLConnectionClient()); > OAuthJSONAccessTokenResponse oAuthResponse = oAuthClient.accessToken(request, OAuthJSONAccessTokenResponse.class); > {code} > I get this error: > {code} > java.io.IOException: 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={}} > {code} > I know that the call is right because I put the produced link directly and I got this output: > {code} > Status Code: 200 OK > Cache-Control: no-cache, no-store > Connection: keep-alive > Content-Encoding: gzip > Content-Language: en-US > Content-Length: 219 > Content-Type: application/json;charset=UTF-8 > { > "access_token": "AQXNduRi5x4mvalm8J6uNmKTur-UJLc7_NydJMeQA_huj2bqcM3mEmHeyicosPpBIheOk_aM9gAyS8iJvQ1Fiu2Y8XfFruB3UCQfVxCHfLVjywlfUN3XEAjXdV-uzXNPDm7NVOVpOsGLmpSSsN_4bcN5_W8uXfazFKBGTjhk9dAUAgj7E0o", > "expires_in": 5182481 > } > {code} > There must be a bug in the oltu code -- This message was sent by Atlassian JIRA (v6.3.4#6332)