Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Trusted Contributor
jppedroso
Posts: 119
Registered: ‎04-29-2010
My Device: Curve 8520
Accepted Solution

Twitter: Could not authenticate with OAuth.

Hi, I'm getting the following exception:

 

java.lang.SecurityException: Could not authenticate with OAuth.

 

Code:

			Credential c = new Credential(CONSUMER_KEY, CONSUMER_SECRET, tTOK);
			UserAccountManager uam = UserAccountManager.getInstance(c);
		
			try {
				if (uam.verifyCredential()) {
					TweetER.getInstance(uam).post(new Tweet(sTweet));
					System.out.println( _res.getString(I18N_MSG_TWITTEROK));
					//Dialog.inform( _res.getString(I18N_MSG_TWITTEROK));					
				}
			} catch (Exception e) {

				System.out.println("Error by posting tweet:" + e);
				//Dialog.inform("Error posting Tweet: " + e);
			}

 

and it allways thows the exception on the line: TweetER.getInstance(uam).post(new Tweet(sTweet));

 

I'm using a sample from Twitter API ME http://kenai.com/projects/twitterapime/pages/Home

 

I've already created the Twitter Application and got Consumer Key and Secret.

 

Does someone has a clue of what could be the problem?

 

Thks!

 

................................................................................................
Tech On!
PTNews
more at On On On!
Developer
pankajace12
Posts: 206
Registered: ‎04-30-2011
My Device: BlackBerry Z10

Re: Twitter: Could not authenticate with OAuth.

Trusted Contributor
jppedroso
Posts: 119
Registered: ‎04-29-2010
My Device: Curve 8520

Re: Twitter: Could not authenticate with OAuth.

thks a lot, I tried that code and worked perfectly!

................................................................................................
Tech On!
PTNews
more at On On On!
Developer
pankajace12
Posts: 206
Registered: ‎04-30-2011
My Device: BlackBerry Z10

Re: Twitter: Could not authenticate with OAuth.

Welcome Jppedroso

Pawan