You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@oltu.apache.org by Grant Slender <gs...@gmail.com> on 2014/04/15 11:12:06 UTC

What has changed in 1.0 from 0.31 ??

Hi,

I had a fully working solution using Oltu version 0.31 but after upgrading
to 1.0 I now get this error message when working with LinkedIn.

Does anyone know of a quick/obvious reason as to what may have caused this?

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={}}
at
org.apache.oltu.oauth2.common.exception.OAuthProblemException.error(OAuthProblemException.java:63)
at
org.apache.oltu.oauth2.client.response.OAuthJSONAccessTokenResponse.setBody(OAuthJSONAccessTokenResponse.java:70)
at
org.apache.oltu.oauth2.client.response.OAuthClientResponse.init(OAuthClientResponse.java:56)
at
org.apache.oltu.oauth2.client.response.OAuthAccessTokenResponse.init(OAuthAccessTokenResponse.java:52)
at
org.apache.oltu.oauth2.client.response.OAuthClientResponseFactory.createCustomResponse(OAuthClientResponseFactory.java:60)
at
org.apache.oltu.oauth2.client.request.RobustURLConnectionClient.execute(RobustURLConnectionClient.java:107)
at
org.apache.oltu.oauth2.client.OAuthClient.accessToken(OAuthClient.java:65)
at
org.apache.oltu.oauth2.client.OAuthClient.accessToken(OAuthClient.java:55)
at
org.apache.oltu.oauth2.client.OAuthClient.accessToken(OAuthClient.java:71)

-- 
Cheers,
Grant

Re: What has changed in 1.0 from 0.31 ??

Posted by Grant Slender <gs...@gmail.com>.
 SocialConnection sc = null;

 TokenRequestBuilder tokenRequestBuilder = null;

 switch (type) {


 case LINKEDIN:

 sc = new LinkedInConnection();

 tokenRequestBuilder = OAuthClientRequest.tokenProvider(OAuthProviderType.
LINKEDIN);

 break;

 default:

 break;

 }


 boolean sociallyConnected = false;


 try {

 tokenRequestBuilder.setGrantType(GrantType.AUTHORIZATION_CODE);

 tokenRequestBuilder.setClientId(sc.getApiKey());

 tokenRequestBuilder.setClientSecret(sc.getApiSecret());


tokenRequestBuilder.setRedirectURI(ServletUtils.getSocialCallbackURL(page));

 tokenRequestBuilder.setCode(requestCode);

 OAuthClientRequest accessRequest = tokenRequestBuilder.buildQueryMessage();

 OAuthClient oAuthClient = new OAuthClient(new RobustURLConnectionClient());

 OAuthJSONAccessTokenResponse oAuthResponse =
oAuthClient.accessToken(accessRequest); /// <<< this is where is fails

 String accessToken = oAuthResponse.getAccessToken();

 // Long expiresIn = oAuthResponse.getExpiresIn();


  switch (type) {


  case LINKEDIN:

  OAuthClientRequest bearerClientRequest =
newLinkedInBearerClientRequest(sc.getProtectedResourceUrl()).setOAuth2AccessToken(accessToken).buildQueryMessage();

  OAuthResourceResponse resourceResponse =
oAuthClient.resource(bearerClientRequest, OAuth.HttpMethod.GET,
OAuthResourceResponse.class);

  sociallyConnected = sc.parseProtectedContent(resourceResponse.getBody());

  break;

 default:

  break;

 }


 } catch (OAuthProblemException e) {

 e.printStackTrace();

 } catch (OAuthSystemException e) {

 e.printStackTrace();

 }


On Tue, Apr 15, 2014 at 7:45 PM, Antonio Sanso <as...@adobe.com> wrote:

> hi Grant ,
>
> may you also past a snippet of your code?
>
> regards
>
> antonio
>
> On Apr 15, 2014, at 11:12 AM, Grant Slender <gs...@gmail.com> wrote:
>
> > Hi,
> >
> > I had a fully working solution using Oltu version 0.31 but after
> upgrading
> > to 1.0 I now get this error message when working with LinkedIn.
> >
> > Does anyone know of a quick/obvious reason as to what may have caused
> this?
> >
> > 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={}}
> > at
> >
> org.apache.oltu.oauth2.common.exception.OAuthProblemException.error(OAuthProblemException.java:63)
> > at
> >
> org.apache.oltu.oauth2.client.response.OAuthJSONAccessTokenResponse.setBody(OAuthJSONAccessTokenResponse.java:70)
> > at
> >
> org.apache.oltu.oauth2.client.response.OAuthClientResponse.init(OAuthClientResponse.java:56)
> > at
> >
> org.apache.oltu.oauth2.client.response.OAuthAccessTokenResponse.init(OAuthAccessTokenResponse.java:52)
> > at
> >
> org.apache.oltu.oauth2.client.response.OAuthClientResponseFactory.createCustomResponse(OAuthClientResponseFactory.java:60)
> > at
> >
> org.apache.oltu.oauth2.client.request.RobustURLConnectionClient.execute(RobustURLConnectionClient.java:107)
> > at
> >
> org.apache.oltu.oauth2.client.OAuthClient.accessToken(OAuthClient.java:65)
> > at
> >
> org.apache.oltu.oauth2.client.OAuthClient.accessToken(OAuthClient.java:55)
> > at
> >
> org.apache.oltu.oauth2.client.OAuthClient.accessToken(OAuthClient.java:71)
> >
> > --
> > Cheers,
> > Grant
>
>


-- 
Cheers,
Grant

Re: What has changed in 1.0 from 0.31 ??

Posted by Antonio Sanso <as...@adobe.com>.
hi Grant ,

may you also past a snippet of your code?

regards

antonio

On Apr 15, 2014, at 11:12 AM, Grant Slender <gs...@gmail.com> wrote:

> Hi,
> 
> I had a fully working solution using Oltu version 0.31 but after upgrading
> to 1.0 I now get this error message when working with LinkedIn.
> 
> Does anyone know of a quick/obvious reason as to what may have caused this?
> 
> 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={}}
> at
> org.apache.oltu.oauth2.common.exception.OAuthProblemException.error(OAuthProblemException.java:63)
> at
> org.apache.oltu.oauth2.client.response.OAuthJSONAccessTokenResponse.setBody(OAuthJSONAccessTokenResponse.java:70)
> at
> org.apache.oltu.oauth2.client.response.OAuthClientResponse.init(OAuthClientResponse.java:56)
> at
> org.apache.oltu.oauth2.client.response.OAuthAccessTokenResponse.init(OAuthAccessTokenResponse.java:52)
> at
> org.apache.oltu.oauth2.client.response.OAuthClientResponseFactory.createCustomResponse(OAuthClientResponseFactory.java:60)
> at
> org.apache.oltu.oauth2.client.request.RobustURLConnectionClient.execute(RobustURLConnectionClient.java:107)
> at
> org.apache.oltu.oauth2.client.OAuthClient.accessToken(OAuthClient.java:65)
> at
> org.apache.oltu.oauth2.client.OAuthClient.accessToken(OAuthClient.java:55)
> at
> org.apache.oltu.oauth2.client.OAuthClient.accessToken(OAuthClient.java:71)
> 
> -- 
> Cheers,
> Grant