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
Developer
Posts: 95
Registered: ‎01-25-2010
My Device: 9530
Accepted Solution

Twitter Aouth not working in device

Hello All ,

 

I am facing problem to work Aouth in device, applicaton working fine in simulator, but when tried in device it say "Authorization fail: Failed to validate oauth signature and token (aouth_request_failed) close this page.)".

 

I am using twitter_api_me-1.8.jar. testing device is 9530.

 

Here is my code which i am trying. Please help where i am doing wrong.

 

	public BrowserFieldScreen() {
		setTitle("Twitter API ME - OAuth");
		BrowserField b = new BrowserField();
		add(b);
		BrowserFieldOAuthDialogWrapper pageWrapper = new BrowserFieldOAuthDialogWrapper(
				b, CONSUMER_KEY, CONSUMER_SECRET, CALLBACK_URL, this);
		pageWrapper.setOAuthListener(this);
		pageWrapper.login();
	}

	/**
	 * @see com.twitterapime.xauth.ui.OAuthDialogListener#onAuthorize(com.twitterapime.xauth.Token)
	 */
	public void onAuthorize(Token token) {
		Credential c = new Credential(CONSUMER_KEY, CONSUMER_SECRET, token);
		UserAccountManager uam = UserAccountManager.getInstance(c);
		//
		try {
			if (uam.verifyCredential()) {
				TweetER.getInstance(uam).post(
						new Tweet("test: " + System.currentTimeMillis()));
				//
				Dialog.alert("Tweet posted!");
			}
		} catch (Exception e) {
			Dialog.alert("Error by posting tweet.");
		}
	}
	/**
	 * @see com.twitterapime.xauth.ui.OAuthDialogListener#onAccessDenied(java.lang.String)
	 */
	public void onAccessDenied(String message) {
		Dialog.alert("Access denied!");
	}

	/**
	 * @see com.twitterapime.xauth.ui.OAuthDialogListener#onFail(java.lang.String,
	 *      java.lang.String)
	 */
	public void onFail(String error, String message) {
		Dialog.alert("Error by authenticating user!");
	}

 

 

 

Highlighted
Developer
Posts: 95
Registered: ‎01-25-2010
My Device: 9530

Re: Twitter Aouth not working in device

 

After some googling and reading this article found the solution , there is probleme with system clock ,it was not accurate. after seting right time problem solved.

 

So , if anyone hit the unlikely case that your Request token doesn’t validate, check your system clock may it solve issue.

 

Thanks

 

Developer
Posts: 139
Registered: ‎02-23-2012
My Device: Blackberry bold
My Carrier: Vodafone India

Re: Twitter Aouth not working in device

Hi rishab

 

I have used user provided code and its working, but the only point where I get struct is at PIN screen. After entering username and password a screen displays a PIN ( an integer value ) after just noting it down If I press back button then the app is getting closed.

 

Can you please explain me what I have to do after that point to post a successfull tweet?

 

Thank you in Advance

 

warm regards
Mohammed Aziz
New Contributor
Posts: 4
Registered: ‎04-09-2011
My Device: Bold 9700
My Carrier: Etisalat Egypt

Re: Twitter Aouth not working in device

Hello,

 

I wanted to ask you what is the exact callback URL u r using, The respose dont get me back to the native application.

 

thanks,

Amir

Developer
Posts: 95
Registered: ‎01-25-2010
My Device: 9530

Re: Twitter Aouth not working in device

[ Edited ]

Hello Mohammed,

 

Can you please check your callback URL, issue you mentioned it seems to happen when callback url is empty or it not proper.

 

let me know if you still have any problem.

 

thanks,