-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android - Tweet function keeps asking for authorizing the app. #9
Comments
Instead of making a separate function, see if this will accomplish what you're looking to do: var short_url = bh.shorten_url(Link); var tweet = "Message content " + shorturl +" "+ tweet; bh.send_tweet(tweet,function(e){ if (e===true) { alertMsg.message = 'Sent!'; } else { alertMsg.message = 'Failed!'; } alertMsg.show(); }); BirdHouse will automatically require authentication when trying to send a tweet, hence the lack of need to use the bh.authorize. Also, the tweet function opens up a dialog box, so I substituted in the send_tweet function. It should also prevent sending a tweet if it is longer than 140 characters. I hope this works, let us know what you find out! |
I had it without the authorize before but that didnt help also I want
|
Sorry, I didn't mention that I never get passed the authorize screen. On the iPhone i get the tweet dialog on android it keeps wanting to authorize even though it already has authorized. |
Here is some log information: W/DefaultRequestDirector( 220): Authentication error: Unable to respond to any of these challenges: {oauth=WWW-Authenticate: OAuth realm="https://api.twitter.com"} |
I found the issue it has to do with the window being modal and the httpclient. This is a known issue with titanium mobile sdk. Here is my work arround: function get_request_verifier(callback) { This check's to see if the user is using iOS and if not then it removes the fullscreen and modal attributes. |
@jgoslin--WOW. That's amazing you figured that out. I was at complete loss as to what the issue was. I will be sure to include this in v1.0, and you get all the credit for that. Hopefully, others can confirm this is true. On behalf of everyone, thank you! |
Hello, thx but this not fix the issue for me. |
This solution (removing the fullscreen and modal attributes) does solve my issue. |
@jgoslin & @jpurcell -- making the dialog non-modal on android fixes the problem for me too. Here's the change I made to get_request_verifier(callback): function get_request_verifier(callback) { var url = "http://api.twitter.com/oauth/authorize?oauth_token="+cfg.request_token; // fix added according to https://github.com/jpurcell/birdhouse/issues/9 // // var win = Ti.UI.createWindow({ // top: 0, // modal: true, // fullscreen: true //}); // if (Ti.Platform.osname=='iphone') { var win = Ti.UI.createWindow({ top: 0, modal: true, // Fix from Appcellerator fullscreen: true }); } else { var win = Ti.UI.createWindow({ top: 0 }); } // end fix // add close button on iPhone ... |
Hey, thanks pardeike! So, this fixes at least one issue. Currently I haven't had a chance to produce an upgrade, but plan to do so soon and will include your fix. Thanks for posting! |
And for the sake of completeness: I am using Titanium Studio GM release with Titanium mobile 1.7.0 and compile for iOS 4.3 and for Android API 2.1. Works fine for me. On a side note, I have a fake completion url which works but on slower devices, it actually shows that page which is ugly and confusing. I will try to find a way to patch this and let you know. Good job so far!! |
Thanks. This worked. Important: It's not enough to set modal & fullscreen to false on Android, they have to be undefined. |
Hi, I am calling the authorize() function of birdhouse and then it is opening webview to access the twitter , after I give the credentials it's generating the token then its closing that page and giving "failed to authorize" alert. I am using Titanium sdk 2.1.1 and i have tried android device and emulator(2.3.3 Google API) also. Please help me. Thanks |
Using the Birdhouse.js version .9 on android keeps requesting authorization even after the app has been authorized. The code works without issue on iPhone.
Here is my code:
var tweet_it = function(){
bh.authorize();
var tweet;
if (Title.length < 30) {tweet = Description} else {tweet = Title};
tweet = "Message content " + shorturl +" "+ tweet;
tweet = tweet.substr(0,140);
bh.tweet(tweet, function(e) {
var alertMsg = Ti.UI.createAlertDialog();
if (e===true) {
alertMsg.message = 'Sent!';
} else {
alertMsg.message = 'Failed!';
}
alertMsg.show();
});
};
bh.shorten_url(Link,tweet_it);
The text was updated successfully, but these errors were encountered: