Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Proxy Issue for LinkedIn #338

gaoming626 opened this Issue · 1 comment

2 participants


When there is no proxy, the Linkedin example works fine.

When there is a proxy, i got an error:

=== LinkedIn's OAuth Workflow ===

Fetching the Request Token...
Exception in thread "main" org.scribe.exceptions.OAuthException: Response body is incorrect. Can't extract token and secret from this: '

999: request failed

  <link rel="stylesheet" type="text/css" href="">


Request denied

Sorry, we are unable to serve your request at this time due to unusual traffic from your network connection.

Please visit our help page and provide the information below for further assistance.

at org.scribe.extractors.TokenExtractorImpl.extract(
at org.scribe.extractors.TokenExtractorImpl.extract(
at org.scribe.oauth.OAuth10aServiceImpl.getRequestToken(
at com.avaya.smm.linkedin.LinkedInExample.main(

My test example is like following:

package com.avaya.smm.linkedin;
import java.util.Scanner;

import org.scribe.builder.;
import org.scribe.model.
import org.scribe.oauth.*;
public class LinkedInExample
// private static final String PROTECTED_RESOURCE_URL = ",last-name)";
private static final String PROTECTED_RESOURCE_URL = "";

// private static final String PROTECTED_RESOURCE_URL = "";
public static void main(String[] args)

  System.setProperty("https.proxyHost", "");
  System.setProperty("https.proxyPort", "8000");

OAuthService service = new ServiceBuilder()

Scanner in = new Scanner(;

System.out.println("=== LinkedIn's OAuth Workflow ===");

// Obtain the Request Token
System.out.println("Fetching the Request Token...");
Token requestToken = service.getRequestToken();

System.out.println("Got the Request Token!");

System.out.println("Now go and authorize Scribe here:");

System.out.println("And paste the verifier here");

Verifier verifier = new Verifier(in.nextLine());
// Trade the Request Token and Verfier for the Access Token
System.out.println("Trading the Request Token for an Access Token...");
Token accessToken = service.getAccessToken(requestToken, verifier);
System.out.println("Got the Access Token!");
System.out.println("(if your curious it looks like this: " + accessToken + " )");
// Now let's go and ask for a protected resource!
System.out.println("Now we're going to access a protected resource...");
OAuthRequest request = new OAuthRequest(Verb.GET, PROTECTED_RESOURCE_URL);
service.signRequest(accessToken, request);
Response response = request.send();
System.out.println("Got it! Lets see what we found...");

System.out.println("Thats it man! Go and build something awesome with Scribe! :)");

//get all the headers
System.out.println("Request headers: " + request.getHeaders().toString());
System.out.println("Response headers: " + response.getHeaders().toString());

// get the url requested
System.out.println("Original location is: " + request.getHeaders().get("content-location"));

// Date of response
System.out.println("The datetime of the response is: " + response.getHeader("Date"));

// Format of the reponse
System.out.println("Format is: " + response.getHeader("x-li-format"));

// Content-type of the response
System.out.println("Content type is: " + response.getHeader("Content-Type") + "\n\n");




Configure the proxy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.