Jump to content

Login Twitter4j


Guest skinie18

Recommended Posts

Ola eu encontrei o twitter4j.org v2.2.6, e estava a tentar fazer o metodo que faz o login da cessao de twitter mas nao estou a conseguir. A quem ja trabalhou com isto agradecia a ajuda.

O meu codigo simplificado:

import twitter4j.Twitter;
import twitter4j.TwitterException;
import twitter4j.TwitterFactory;
import twitter4j.User;
import twitter4j.auth.*;
public class TwitterLab {
private static Twitter twitter;

public static void main(String[] args) {
 String usr = "teste";
 String pass = "test";

 try {
	 twitter = new TwitterFactory().getInstance();
		 AccessToken at = twitter.getOAuthAccessToken(usr, pass);

		 twitter = new TwitterFactory().getInstance(at);
	 User user = twitter.verifyCredentials();
	 System.out.println("Successfully verified credentials of " + user.getScreenName());
	 System.exit(0);
 } catch (TwitterException te) {
	 te.printStackTrace();
	 System.out.println("Failed to verify credentials: " + te.getMessage());
	 System.exit(-1);
 }
}
}

Alguem me pode ajudar com o algum codigo, ou explicando porque que me da o erro:

java.lang.IllegalStateException: OAuth consumer key/secret combination not supplied

???

Edited by Guest
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.