Twitter OAuth

Wow. I'm so at a loss yet again.

First, can we request that the demo code for twitter be removed? The fact that it's completely old and doesn't even remotely work wasted a bit of my time and I'm sure the time of anyone who is looking to add twitter support to their apps.

Is there anyone who can help explain how to use the Oauth code that's in the code exchange?
http://developer.anscamobile.com/code/oauth-library

I've tried it, but I haven't the faintest idea what I'm supposed to do next. I'm getting an event.response of "unauthorized."

What next? I set up my app with dev.twitter.com, I've got the consumer key and consumer secret loaded into the main.lua, and I used www.google.com as the options.token_ready_url

But what now? I don't even know what unauthorized means! Did I set something up wrong on the twitter end of things? Is there better demo code anywhere that I can look at? Is there anyone that has a simple app that actually works with twitter Oauth?

Please help!

(Oh, and waiting for official support is not possible as I need this to work before next week)

Hey Gigaflop,

This doesn't use oAuth but should work fine for posting to Twitter, is it an option?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
local function escape (s)
        s = string.gsub(s, "([&=+%c])", function (c)
                        return string.format("%%%02X", string.byte(c))
                end)
        s = string.gsub(s, " ", "+")
        return s
end
 
local tweetText = "This is the tweet message."
 
local postBody = escape( tweetText )
local theNetwork = theNetwork or "twitter" -- twitter is default
 
--local theString = string.gsub(message, "( )", "%%20")
if theNetwork == theNetwork or "twitter" then
        native.showWebPopup(20, 20, display.contentWidth - 40, display.contentHeight - 90, "http://twitter.com/intent/tweet?text="..postBody)
end

Ok, not the most elegant solution but it works! Thank you.

views:1590 update:2012/1/13 9:04:04
corona forums © 2003-2011