Uploaded image for project: 'Apache Oltu'
  1. Apache Oltu
  2. OLTU-170

Exception when obtaining access token for LINKED IN

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • oauth2-1.0.0
    • None
    • oauth2-client
    • None
    • Win7/JDK8.31

    Description

      After obtaining the code I make this call:

      			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);			
      
      

      I get this error:

      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={}}
      
      

      I know that the call is right because I put the produced link directly and I got this output:

      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
          }
      
      
      
      

      There must be a bug in the oltu code

      Attachments

        Activity

          People

            Unassigned Unassigned
            biliboc Constantin Mitocaru
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: