ARN
ARN

Reputation: 11

pin in twitter4j

How can I get the pin for the twitter 4j ?

 accessToken = twitter.getOAuthAccessToken(requestToken, pin);

please help..!

Upvotes: 1

Views: 1695

Answers (3)

Maria
Maria

Reputation: 86

If you take a look to the twitter4J Code Examples, you see that the user is suppose to write the pin that he gets from the Twitter website where he will be redirected. If you want to take the pin from the URL without the user having to introduce it manually, I think the pin comes in the URL as "oauth_verifier". I did all the login with signpost because I didn't want the user having to write anything and I wasn't able to do it using only Twitter4J. Once I have the access token, I create the Twitter object from twitter4j with twitter = twitterfact.getOAuthAuthorizedInstance(consumerKey, consumerSecret,accessToken);and it works fine. This way it was much easier for me.

Upvotes: 5

technoSpino
technoSpino

Reputation: 510

You should be able to get away without using the PIN.

Twiiter4j DOC

Blog Post stating it is not required by Twitter

Upvotes: 0

Heiko Rupp
Heiko Rupp

Reputation: 30944

You need to redirect the user with a request token (that you can get from Twitter) to the twitter site, where the user enters the username/password and gets the pin back.

See e.g. https://github.com/pilhuhn/ZwitscherA/blob/master/src/de/bsd/zwitscher/account/LoginActivity.java#L69 on how to direct to Twitter and then https://github.com/pilhuhn/ZwitscherA/blob/master/src/de/bsd/zwitscher/account/LoginActivity.java#L91 when the user has the pin and needs to proceed

Upvotes: 0

Related Questions