-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Start
First of all, you need to install scribe. You either download the jar manually from the downloads page and include apache commons codec, or just let maven take care of everything adding this to your pom.xml file:
<dependency> <groupId>org.scribe</groupId> <artifactId>scribe</artifactId> <version>1.1.2</version> </dependency>
OAuthService service = new ServiceBuilder() .provider(TwitterApi.class) .apiKey("your_api_key") .apiSecret("your_api_secret") .build();
Token requestToken = service.getRequestToken()
String authUrl = service.getAuthorizationUrl(requestToken)
Verifier v = new Verifier("verifier you got from the user"); Token accessToken = service.getAccessToken(requestToken, verifier);
OAuthRequest request = new OAuthRequest(Verb.GET, "http://api.twitter.com/1/account/verify_credentials.xml"); service.signRequest(accessToken, request); // the access token from step 4 Response response = request.send(); System.out.println(response.getBody());