Jump to content
skinie18

Login Twitter4j

Recommended Posts

skinie18

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 skinie18

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • 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.