Search code examples
javatwitterscribe

Java Twitter Client with Scribe (1st time using it). How to post status?


I'm just starting to use Scribe Library to update my Twitter status.

When I read many pages telling me that Scribe library known as Twitter Library, So, I dig deep into the GitHub of the Scribe library, but I ended up with a confused head.

Especially with this Example file. If you've opened it, you'll see this line of code:

Verifier verifier = new Verifier(in.nextLine());

1) The user need to input the PIN code? At the first time I tried to follow the example yes. I understand that we need to grant the access of the java app. But for the next... should we always entering the PIN code?

My purpose is only posting a new tweet... Could we get the Verifier PIN not from the Browser? From the API perhaps?

CMIIW.


Solution

  • The pin code is used in the OOB (Out of Band) flow. The other (normal) flow is providing a callback url where you get the redirect with the verifier, you can do this using the callback("http://your-host/url") method on the ServiceBuilder.

    You can (and are encouraged to) save the access_token so you don't need to authenticate your users every time.