oAuth Token & JSON

15 views
Skip to first unread message

Eric Garside

unread,
Jul 31, 2009, 4:59:03 PM7/31/09
to Twitter Development Talk
Hey all,

I'm working on a Javascript library for full API access with Twitter,
and a current hickup in the system is fetching the oAuth token from
Javascript.

I'm new to the twitter API, so I'm not sure if I'm missing something,
but I can't seem to get my API call to:

http://twitter.com/oauth/request_token

to return JSON to me. Is this something doable? (Ideally through a
jsonp implementation)

JDG

unread,
Jul 31, 2009, 7:54:01 PM7/31/09
to twitter-deve...@googlegroups.com
That will never return JSON, per the OAuth spec. It will return a token in the HTTP Query String format. If you are using Dojo, you can use dojo.queryToObject to convert it to json.
--
Internets. Serious business.

JDG

unread,
Jul 31, 2009, 8:00:26 PM7/31/09
to twitter-deve...@googlegroups.com
alternatively, you could of course do something like this:

var token = {};

var parts = theReturnString.split('&');

for (var part in parts) {
   var parm = part.split('=');
   token[parm[0]] = parm[1] || "";
--
Internets. Serious business.
Reply all
Reply to author
Forward
0 new messages