I am using twitter4j and the following code:
public static void OAuthLogin(Activity a) {
try {
twitter = new TwitterFactory().getInstance();
twitter.setOAuthConsumer(key, secret);
RequestToken requestToken = twitter.getOAuthRequestToken(CALLBACK);
String authUrl = requestToken.getAuthenticationURL();
a.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(authUrl)));
} catch (TwitterException ex) {
Log.e("in Main.OAuthLogin", ex.getMessage());
}
}
and getting
401:Authentication credentials (https://dev.twitter.com/docs/auth) were missing or incorrect. Ensure that you have set valid conumer key/secret, access token/secret, and the system clock in in sync.
when executing twitter.getOAuthRequestToken() Once I remove CALLABACK param everything’s fine – I am redirected to twitter login page where I can get PIN. The thing is that I do not want the user to deal with the PIN and be brought back to the app instead. How do I achieve that?
EDIT: found what’s causing the problem and modified the question
You MUST set [dummy] callback URL on application page @ twitter!