Post a Tweet from iPhone App - Stuck on Callback URL

You must Login before you can answer or comment on any questions.

Hiya

I am needing to send a tweet for from my iphone/ipad app. I found the following example on github (code also posted below for this):

https://gist.github.com/2eabc31db388144b3abc

I have created my app details (key,secret etc) in my twitter developer account and using the code from the example i get the twitter login and authorisation popup but once you click authorise, all i get is a webview showing the callback url (that i was required to put in the twitter app settings). So the app is stuck on a webview showing the callback url but does nothing after. If i close the popup window it just goes back to my app without sending a tweet.

Can anyone help?

app.js

var win = Ti.UI.createWindow({ backgroundColor: '#fff' });
var shareButton = Ti.UI.createButton({
    width: 90, bottom: 10, height: 30,
    title: 'Tweet!"'
});
win.add(shareButton);
win.open();
 
var social = require('social');
var twitter = social.create({
    site: 'Twitter',
    consumerKey: 'XXXXXXXXXXXXXXXX', 
    consumerSecret: 'XXXXXXXXXXXXXXXXXXXXX' 
});
 
shareButton.addEventListener('click', function() {
    twitter.share({
        message: 'Hello, world!',
        success: function() {
            alert('Tweeted!');
        },
        error: function(error) {
            alert('Oh no! ' + error);
        }
    });
});
Lauren :)

1 Answer

Accepted Answer

I believe that you do not need the callback URL when using social.js

— answered 2 years ago by Aaron Saunders
answer permalink
6 Comments
  • Hi Aaron, thanks for your answer, when i set up the app in twitter i was told to enter a callback URL (it was a require field). I don't mention it within the app.js, and i also did a search through social.js code and couldn't find a reference for it.

    Is there anything i am doing wrong with my code then? As i am literally just using the above app.js code and no changes to social.js. I noticed you were the person who recommended this example in another post :)

    If you could help i would really appreciate it, i've been trying to solve this all weekend using different examples/tutorials with no luck :(

    — commented 2 years ago by Lauren McCold

  • i did not set a URL and my code is working

    See Link

    — commented 2 years ago by Aaron Saunders

  • I've just created my app again in twitter and i was able to leave the callback URL as blank. For some reason the first app i tried was requiring one (i so i thought!!). Sorry for the confusion and thanks for the help :)

    — commented 2 years ago by Lauren McCold

  • Show 3 more comments

Your Answer

Think you can help? Login to answer this question!