marcinnitro
|
Posted: October 24, 2011 15:47 by marcinnitro
|
|
Hi, Thanks a lot for your efforts in creating this lib. I believe this is a great thing and it is really appreciated as there are hardly any other solutions like that for Java ME. I was really excited to get the 1.8 version working with OAuth, because I was thinking I would be finally able to use it in my Blackberry App (designed for Torch 9800). So I downloaded the latest library as well as the OAuth Sample RIM application. I've entered my application's customer key, secret and callback url. I tried to run it on the simulator, but I'm getting: JVM Error 104 Uncaught: Runtime Exception before I even see the Twitter login screen. Am I doing something wrong here? I also tried to run it on a real device (I made the OAuth sample application part of my real, signed by RIM app, so it can be started on a Torch), but I'm probably getting the same error as the only result is a blank screen - no login page at all. What's more weird - if I try to run it again and again I'm also getting uncaught ControlledAccessException. I'd appreciate any suggestions and help. Thanks, Marcin |
Problems with the Sample OAuth for Blackberry (RIM)
Replies: 17 - Last Post: May 21, 2012 08:59
by: nagsethiya
by: nagsethiya
showing 1 - 18 of 18
Ernandes Mourao Junior
|
Posted: October 24, 2011 19:28 by Ernandes Mourao Junior
|
| In your case, have you added to your project the lib's dependencies? To work with OAuth on RIM, you need to use BrowserContentManager class, which requires the app to be signed. Are you signing it properly? |
marcinnitro
|
Posted: October 25, 2011 07:28 by marcinnitro
|
|
Hi Ernandes, Thanks a lot for a rapid answer. Yes, the BrowserContentManager is included. I tried compiling it with RIM's 5.0 and 6.0 sdk, but exactly the same results. My application is signed by RIM and is allowed to use restricted classes, like BrowserContentManager. I actually managed to get to the login screen a few times (I'm really not sure why this worked one or two time and usually is throwing those exceptions), but I had to enable "process javascript" and "process styles" options for the BrowserContentManager to be able to login. The onAuthorize method was not invoked anyway then. I'm kind of stuck because I'm not very eager to develop from scratch something that has been definitely thought through by the library authors. |
Ernandes Mourao Junior
|
Posted: October 25, 2011 14:10 by Ernandes Mourao Junior
|
| Keep trying. As soon as I have a spare time I will check that. |
itoledo
|
Posted: October 24, 2011 16:53 by itoledo
|
|
I'm also having problems with oauth on BlackBerry. I managed to get to the login page, and the login seems to be succesful, it gets to the callback url, but I get the following error in the onFail handler: error: oauth_access_token_failed message: <?xml version="1.0" encoding="UTF-8"?> <hash> <error>Invalid oauth_verifier parameter</error> <request>/oauth/access_token</request> </hash> Thanks, Ivan |
Ernandes Mourao Junior
|
Posted: October 24, 2011 19:26 by Ernandes Mourao Junior
|
| In your case, have you tried to run on device? |
itoledo
|
Posted: October 24, 2011 19:31 by itoledo
|
|
Ernandes: Yes, tried with BB 8520 with OS5. I'm using the correct timezone for my country (GMT-4, Santiago de Chile). I'm using the same consumer key/secret that's being used on my Android version of the same app, so it should work. BTW thanks for your efforts! Ivan |
heynold
|
Posted: October 25, 2011 12:45 by heynold
|
| I have the exact same problem with the sample. I run the app on simulator with OS 5.0. Get the JVM Error 104 Uncought : Illegal argument exception, right after logging in to twitter. However, it manage to post a tweet using the token in onAuthorize() function. |
Ernandes Mourao Junior
|
Posted: October 25, 2011 14:08 by Ernandes Mourao Junior
|
| So it did work. Try to debug to find this JVM Error 104. Maybe it is another thing. |
itoledo
|
Posted: October 28, 2011 19:55 by itoledo
|
|
Ernandes: Figured out that BlackBerry's redEvent.getLocation() (at BrowserContentManagerOAuthDialogWrapper) gets the URL in LOWERCASE!!! that's why it's failing when trying to validate the keys. This seems to be a bug in BrowserContentManager... I'm trying right now with BrowserFieldOAuthDialogWrapper and managed to twit from my app... got an error in the browser but the tweet got through so I'll try to fix it and send you the patch. Thanks! Ivan Toledo |
Ernandes Mourao Junior
|
Posted: October 31, 2011 12:32 by Ernandes Mourao Junior
|
|
Because getLocation() returns always in lowercase, it means the comparison in trackUrl() method is failing, right? Please, let me know if you can fix this and then send to me so I can update the project. Thanks! |
Ernandes Mourao Junior
|
Posted: January 02, 2012 12:12 by Ernandes Mourao Junior
|
|
Hi, Danz Please, explain me betther what is happening to you. Regards, |
danz_oye
|
Posted: January 08, 2012 03:08 by danz_oye
|
|
Hi Ernandes, Thanks a lot for a quick answer. I try your sample for RIM using both simulator and real device, 8520. it success show authorize page. then i sign in and it success redirect to may callback url. but when i check my twitter account, my app not in the application list. so i debug it, and just like Ivan problem, redEvent.getLocation() (at BrowserContentManagerOAuthDialogWrapper) gets the url in lowercase. and i think it is a RIM's bug. is there something i can do to make it work?or i miss something?actually i just compile and install your sample. Regards, |
Ernandes Mourao Junior
|
Posted: January 11, 2012 20:08 by Ernandes Mourao Junior
|
|
I do not see a connection between your app is not listed in your account's apps list and the fact of redEvent.getLocation() is returning the url in lower case. Were you able to login sucessfuly at least? Either simulator or device? I would like to know whether this behavior of redEvent.getLocation() is causing the login fails. Does that proceed? Support this project: Donate now! |
cyberlinks
|
Posted: January 19, 2012 05:32 by cyberlinks
|
|
i want to update status on twitter using blackberry simulator 9930 but i am getting error when i run my simulator error is Uncaught exception:read only application cant post my code is this Token token = new Token(token_access, token_secret); Credential c = new Credential(username, con_key, con_secret, token); UserAccountManager m = UserAccountManager.getInstance(c); if (m.verifyCredential()) { System.out.println("User's credentials are OK! You're now logged in!"); Tweet t = new Tweet("Cool! Geo-located tweet via Twitter API ME."); TweetER ter = TweetER.getInstance(m); t = ter.post(t); } else { System.out.println("Consumer or token keys are invalid!"); } } } i am using twitter_api_1.8.2.jar in eclipse open a new page with this error the jar file twitter_api_1.8.jar has no source attachment u can attach the source by clicking attach source please solve my problem thanks in advance please help me...................... |
kelospario
|
Posted: February 01, 2012 18:50 by kelospario
|
|
Hi all. Im not able to get this sample to work. at method protected void trackUrl(String url) im getting this response: <?xml version="1.0" encoding="UTF-8"?> <hash> <error>Invalid oauth_verifier parameter</error> <request>/oauth/access_token</request> </hash> I have checked the redEvent.getLocation() call and it returns the verifier in lowercase. How can i retrieve the verifier in a non lowercase format? Thanks to all. |
nagsethiya
|
Posted: May 21, 2012 08:59 by nagsethiya
|
|
In blackberry-twitter integration ,login page is open .After login, call back url page open then exception generated JVM 104:Run time exception .And I click continue then twitter Authorization granted! close this page. but not post on my wall.....sir please solve my problem. i using twitter api me 1.8 code here:- import net.rim.device.api.ui.UiApplication; public class Home extends UiApplication { public static void main(String[] args) { Home app = new Home(); app.enterEventDispatcher(); } public Home() { pushScreen(new TwitterAPIMERIMOauthSample()); } } ////////////////////////////////////////////////////////////////////////////////////////////////////// import impl.rim.com.twitterapime.xauth.ui.BrowserContentManagerOAuthDialogWrapper; import java.io.IOException; import com.twitterapime.rest.Credential; import com.twitterapime.rest.GeoLocation; import com.twitterapime.rest.TweetER; import com.twitterapime.rest.UserAccountManager; import com.twitterapime.search.LimitExceededException; import com.twitterapime.search.Tweet; import com.twitterapime.xauth.Token; import com.twitterapime.xauth.ui.OAuthDialogListener; import com.twitterapime.xauth.ui.OAuthDialogWrapper; import net.rim.device.api.browser.field.BrowserContentManager; import net.rim.device.api.browser.field.RenderingOptions; import net.rim.device.api.browser.field2.BrowserField; import net.rim.device.api.ui.UiApplication; import net.rim.device.api.ui.component.Dialog; import net.rim.device.api.ui.container.MainScreen; public class TwitterAPIMERIMOauthSample extends MainScreen implements OAuthDialogListener { String CONSUMER_KEY = ""; String CONSUMER_SECRET = ""; String CALLBACK_URL = ""; public TwitterAPIMERIMOauthSample() { super(VERTICAL_SCROLL); setTitle("Twitter API ME - OAuth"); BrowserField browserField = new BrowserField(); //BrowserContentManager browserMngr = new BrowserContentManager(0); //RenderingOptions rendOptions = browserMngr.getRenderingSession().getRenderingOptions(); //rendOptions.setProperty(RenderingOptions.CORE_OPTIONS_GUID,RenderingOptions.SHOW_IMAGES_IN_HTML,false); add(browserField); OAuthDialogWrapper pageWrapper = new BrowserFieldOAuthDialogWrapper(browserField); pageWrapper.setConsumerKey(CONSUMER_KEY); pageWrapper.setConsumerSecret(CONSUMER_SECRET); pageWrapper.setCallbackUrl(CALLBACK_URL); pageWrapper.setOAuthListener(this); pageWrapper.login(); } public void onAccessDenied(String arg0) { } public void onAuthorize(Token token) { Credential c = new Credential(CONSUMER_KEY, CONSUMER_SECRET, token); UserAccountManager m = UserAccountManager.getInstance(c); String twitter_username = token.getUsername(); Dialog.alert(twitter_username); try { if (m.verifyCredential()) { //String twitter_username = token.getUsername(); //Dialog.alert(twitter_username); Tweet t = new Tweet("Hi!!! This is my first tweet via Twitter API ME. "); TweetER ter = TweetER.getInstance(m); t = ter.post(t); Dialog.alert("Posted"); } else Dialog.alert("User name and/or password are invalid!"); } catch (IOException e) { e.printStackTrace(); } catch (LimitExceededException e) { e.printStackTrace(); } } public void onFail(String arg0, String arg1) { }} /////////////////////////////////////////////////////////////////////////////////////////////////////////////// import java.io.IOException; import org.w3c.dom.Document; import net.rim.device.api.browser.field2.BrowserField; import net.rim.device.api.browser.field2.BrowserFieldListener; import net.rim.device.api.ui.UiApplication; import com.twitterapime.rest.Credential; import com.twitterapime.rest.GeoLocation; import com.twitterapime.rest.TweetER; import com.twitterapime.rest.UserAccountManager; import com.twitterapime.search.LimitExceededException; import com.twitterapime.search.Tweet; import com.twitterapime.xauth.Token; import com.twitterapime.xauth.ui.OAuthDialogListener; import com.twitterapime.xauth.ui.OAuthDialogWrapper; public final class BrowserFieldOAuthDialogWrapper extends OAuthDialogWrapper { private BrowserField browserField; public BrowserFieldOAuthDialogWrapper(BrowserField browserField,String consumerKey, String consumerSecret, String callbackUrl,OAuthDialogListener oauthListener) { super(consumerKey, consumerSecret, callbackUrl, oauthListener); if (browserField == null) { throw new IllegalArgumentException("BrowserField must not be null."); } this.browserField = browserField; this.browserField.addListener(new BrowserFieldListenerOAuth()); } public BrowserFieldOAuthDialogWrapper(BrowserField browserField) { this(browserField, null, null, null, null); } protected void loadUrl(String url) { browserField.requestContent(url); } protected void loadHTML(String htmlContent) { browserField.displayContent(htmlContent, callbackUrl); } private class BrowserFieldListenerOAuth extends BrowserFieldListener { public void documentLoaded(BrowserField browserField, Document document)throws Exception { trackUrl(browserField.getDocumentUrl()); }} } Sir please solve my problem as soon as thanking you |
showing 1 - 18 of 18
Replies: 17 - Last Post: May 21, 2012 08:59
by: nagsethiya
by: nagsethiya







