3

I am trying to get the authorization url to allow my users to authorize my app for twitter api calls.

I have registered the app at Twitter and gotten the Consumer Key and Secret.

scribe-1.1.3.jar and commons-code-1.5.jar are in the Classpath.

I am running behind a proxy and added System.setProperty("java.net.useSystemProxies", "true");

The code follows:

ServiceBuilder lBuilder = new ServiceBuilder();
lBuilder.provider(TwitterApi.class);
lBuilder.apiKey("----");
lBuilder.apiSecret("----");
OAuthService lService = lBuilder.build();

Token lAccessToken = lService.getRequestToken();

The last line throws exception:

org.scribe.exceptions.OAuthException: Response body is incorrect. Can't extract token and secret from this: 'Failed to validate oauth signature and token'
    at org.scribe.extractors.TokenExtractorImpl.extract(TokenExtractorImpl.java:41)
    at org.scribe.extractors.TokenExtractorImpl.extract(TokenExtractorImpl.java:27)
    at org.scribe.oauth.OAuth10aServiceImpl.getRequestToken(OAuth10aServiceImpl.java:45)

It looks like the Twitter response is empty or missing.

Also, I am using a servlet based App and all of your examples are retrieving responses from System.in.

Can I capture the incoming responses through the scribe API?

Thank you.

  • Never mind - problem solved - my bad - sorry about that. I was truncating the end of the Consumer Secret Key. Also able to capture the incoming responses just fine. Still confused about how to turn the Pin Number that I get from the Twitter authorization url into an Access Key and Secret to build the access token. Access works fine when I use the Access Token info directly from the Twitter page. Thank you. – Martin Kultermann Jul 20 '11 at 19:58

0 Answers0