Twitter single sign-on

Hi.
Are there any plans for Twitter single sign-on support?

Geir. [import]uid: 38237 topic_id: 26729 reply_id: 326729[/import]

Look at the Twitter sample in the current Daily Builds. It’s been updated to use OAuth. [import]uid: 7559 topic_id: 26729 reply_id: 108379[/import]

Whoa - when did that happen? I never saw any sort of notice that OAuth and/or Twitter was working in the daily builds, and I check regularly!

Glad to see it’s in there, but please let me know if there’s someplace I should be checking (beside the daily build reports) for new feature details.

Thanks,
Jason [import]uid: 27636 topic_id: 26729 reply_id: 108406[/import]

The Twitter app was updated a few months ago. Sample code changes don’t get reported in the Daily Build summary so there is no good way to know when changes occur. I’ll keep that in mind when we make major changes/additions to the sample code and make announcements on the forum and on our blog. I did mention the Twitter sample update on the forum but it was easy to miss. [import]uid: 7559 topic_id: 26729 reply_id: 108409[/import]

@Tom

Is the new example a working one?

I’ve been trying to get this working, but everytime I get the error message

Failed: Invalid Token

I created an app in twitter and Changed the consumer_key and consumer_secret values in the sample app. Is there anything else I must do? [import]uid: 64174 topic_id: 26729 reply_id: 113247[/import]

I’m having trouble with this too. I did not originally specify a call back URL when I created the app at Twitter and that will cause problems with the sample app. So make sure you provide a call back (not that any one will actually use it)

Next make sure you didn’t cut/paste a space or something else when you copied the two bits from the web page. The consumer key likes to pick up a leading space for some reason.

I’m to a point it tells me it sent the tweet, but I never see the tweet, and I’m really confused about it.
[import]uid: 19626 topic_id: 26729 reply_id: 113267[/import]

Just solved my problem. When you create your twitter app, there are options for “Read Only”, “Read/Write” and “Read/Write with access to direct messages”. This is off screen and I didn’t notice it was there and it defaults to Read Only.

[import]uid: 19626 topic_id: 26729 reply_id: 113271[/import]

Woah! Gave a callback URL!
Voila! Works like a charm! Thanks a million ROB!

And yeah. I had already set access to Read/Write :slight_smile:
[import]uid: 64174 topic_id: 26729 reply_id: 113273[/import]

@Satheesh I have no clue. I’m happy to have worked out the details I have so far. Posting media is so not on my radar, so I haven’t even looked at the API. And as much as I would love to help figure this out, I’m so deep in projects right now, I can’t really afford any research time on it.

[import]uid: 19626 topic_id: 26729 reply_id: 113280[/import]

@Rob and others

I am trying to upload an image using this Twitter library.

SO after going through the Twitter developer docs, I did the following

How do I carry on from here? I mean, how do I upload the image and specify it in the post request?

Any pointers? [import]uid: 64174 topic_id: 26729 reply_id: 113276[/import]

no worries!

I will have a go at it and post a solution when I find one!

Thanks anyway!

[import]uid: 64174 topic_id: 26729 reply_id: 113281[/import]

I’m looking at it now. You piqued my interest…

First of all, you should be using the URL:

https://upload.twitter.com/1/statuses/update_with_media.format

instead of api.twitter.com

There is something about adding a signature to the oAUTH package. I’m not quite sure I understood that, nor did I see where to specify the image.

[import]uid: 19626 topic_id: 26729 reply_id: 113283[/import]

Eep! yes, thats a silly mistake.

and yeah. thats the place where I’m stuck.

I found this code that is supposed to work.
https://github.com/themattharris/tmhOAuth
and this: http://stackoverflow.com/questions/7301010/update-twitter-status-with-media-with-twitter-async

but my knowledge pf Php is amost zilch. So I leave it to the experts! :smiley: [import]uid: 64174 topic_id: 26729 reply_id: 113295[/import]

Well. I can only think of one way to upload the image.

[lua]local filename = “image.png”
local path = system.pathForFile( filename,system.ResourceDirectory )
local fileHandle = io.open( path, “rb” )
local contents = fileHandle:read( “*a” )
–local contents = mime.b64(contents)

local params = {}

params[1] =
{
key = ‘status’,
value = postMessage
}

params[2] =
{
key = ‘media[]’,
value = contents,
}[/lua]

Did not work.

If anyone find a way, please comment here [import]uid: 64174 topic_id: 26729 reply_id: 113296[/import]

Hope somebody might be able to help. I’m looking through the Sample App, created an app via Twitter and copy/pasted consumer_key and consumer_secret into the code.

However I’m getting a runtime error claiming that my consumer key is malformed.

/Applications/CoronaSDK/SampleCode/Networking/Twitter/Twitter.lua:21: malformed number near ‘67vZwonrLMo7vg6GuA6Tg’

If I put the key between quote marks it gets a little further, but throws an alert message from the following code:

if not consumer\_key or not consumer\_secret then  
 -- Handle the response from showAlert dialog boxbox  
 --  
 local function onComplete( event )  
 if event.index == 1 then  
 system.openURL( "https://dev.twitter.com//" )  
 end  
 end  
  
 native.showAlert( "Error", "To develop for Twitter, you need to get an API key and application secret. This is available from Twitter's website.",  
 { "Learn More", "Cancel" }, onComplete )  
end  

When I attempt to print out the consumer_key and consumer_secret variables immediately after declaring them, I get nil ?!?!

Any ideas would be massively appreciated. [import]uid: 33275 topic_id: 26729 reply_id: 114181[/import]

Hello Guys,

Is there any update to post image to twitter? From what i have done, i tried to convert image to multipart/form-data to use with media[] param, but still nothing happened. I’m not sure whether the problem is from converting to multipart/form-data or from the oAUTH signature. Just Tweeting works fine.

Does anyone has any more ideas? [import]uid: 81883 topic_id: 26729 reply_id: 114705[/import]