What is this PIN thats been requested?


hi! i am using yusuke’s twitter4j and it is asking me for a PIN which i do not know what it is.

besides the consumer key, access token is there anything else im leaving out?



One method of authenticating via OAuth is called out-of-band (OOB). Instead of redirecting a user to a callback URL this method of OAuth instead displays a pin code for the user to input into an application. It sounds like this is the pin code being referred to.

If you already have an oauth_token and oauth_secret for your account this step shouldn’t be necessary though.

When are you being asked for the pin?


im using his example to post “hello twitter” to my twitter, it is my own account and it is only one account that i am posting to

when i run it via updateStatus.cmd itll do its thing then it asks me for the PIN but i have already put the access token, access token secret, consumer key, consumer secret in the properties file though.


oh i finally got it to work…

but it seems like every time i run the code itll ask me to go to:
http://api.twitter.com/oauth/authorize?oauth_token=L-------------------------------------------------u to get the PIN number, is there any way to get around that? without getting the PIN? because i am trying to do automated tweets using a crontab and i think this might be a problem.


Our OAuth implementation only needs you to go through the authorization step once. The code you’re using is an end-to-end example. To be used in a crontab, you’ll need to write your own program that will re-use the credentials that you initially negotiate instead of renegotiating the credentials each time as the example code in Twitter4J is demonstrating.


is there a way to post without the PIN?


also, i have the access token already saved as both a string AND in the properties file, isnt that enough?


You don’t need a PIN to post. The PIN code is only used during the token negotiation step when initially getting your access token. From that point forward, the PIN/oauth_verifier is meaningless and can be thrown away and forgotten about forever (or until the next time you need to obtain an access token).

I don’t know how the code you’re writing/executing necessarily works. I do know that Twitter4J works for many people but that you’ll need to do some programming to get it to work for your use case.


ok sorry for sounding stupid but to POST all i need is my consumer key, consumer secret, access token, and access token secret?


There’s many variables to all this so it’s easy to get mixed up.

Yes, you just need a consumer secret, access token, and access token secret permissioned for RW to post.


i have the same problem…i need the permanent authorization with twitter … if it is possible? how to get it please help me…


its not necessary to always go to the site to get the PIN as it is not needed

ill post my working solution to post to twitter when i get to work


wait, are you using the example from yusuke github? cause all you have to do is have a twitter4j.properties file and all the information will be stored there without needing a PIN to post to your twitter.


How do you stop the Twitter OAuth from even asking a user for that pin once they have Authorized your app? It is very ugly and since it doesn;'t do anything, why have it?


pin is not needed though… if you are using the demo yusuke put up on github u just have to change it up a bit to avoid the pin…

i set up the credentials via configuration

// set credentials for twitter account
ConfigurationBuilder cb = new ConfigurationBuilder();
cb.setDebugEnabled(true) .setOAuthConsumerKey(twitterAccountInfo.getConsumerKey())

TwitterFactory factory = new TwitterFactory(cb.build());
Twitter twitter = factory.getInstance();

im able to tweet through my java file without using a pin


how do I get my PIN? For authorization.


thanks, I’ll try it


Can anybody please explain me how to prevent checking for callback url in android? Because in android I know it is necessary to enter the callback url. But am doing a mimic of iPhone where callback url is not permitted. So any answer on this?



i have a issue where after logging into twitter , i get step of authentication process where its showing a pin of 7 digits, so where should i authenticate the pin or may be how shud i use the pin or do i have a mechanism to bypass pin request authentication…


yes how do i get my pin