Post a Tweet from iPhone App - Stuck on Callback URL


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):

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?


var win = Ti.UI.createWindow({ backgroundColor: '#fff' });
var shareButton = Ti.UI.createButton({
    width: 90, bottom: 10, height: 30,
    title: 'Tweet!"'

var social = require('social');
var twitter = social.create({
    site: 'Twitter',
    consumerKey: 'XXXXXXXXXXXXXXXX', 
    consumerSecret: 'XXXXXXXXXXXXXXXXXXXXX' 

shareButton.addEventListener('click', function() {
        message: 'Hello, world!',
        success: function() {
        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 3 years ago by Aaron Saunders
    • 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 3 years ago by Lauren McCold
    • i did not set a URL and my code is working

      See Link

      — commented 3 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 3 years ago by Lauren McCold
    • Hello @Lauren and @Aaron

      I am using the same code. When progress bar completes, it show an error alert 'Twitter did not give us a request token!'. Am missing something in twitter app?

      — commented 3 years ago by Ammar Asim
    • Error occurs here: adapter.getRequestToken

      — commented 3 years ago by Ammar Asim
    • Hi Ammar,
      Did you solve this issue ? if yes, can you please share the solution ?

      — commented a year ago by Muhammad Sabir