Regis Zaleman
Regis Zaleman

Reputation: 3240

Getting Twitter oauth access token within Ajax app

I am creating an widget app where all the front end is in javascript using jQuery. I make ajax calls to php server scripts for all server interactions. I am trying to get auhorized with Twitter to be able to send Twits on behalf of my users,using the Zend oauth class. I get to the redirect alright, go to twitter, accept authorization and then I am stuck. Because my redirect page needs to be the same page as the page we left from, where the app is living. Now, after coming back from Twitter, Zend wants to use the $_GET, but because I am calling all my php scripts from javascript/ajax, I don't know how to pass the whole $_GET to the php script which is supposed to request the final access authorization token... I seem to fail when I just extract variables from the url and send them to php through ajax to the Zend functions... Is there a better way to deal with oauth authentification with an ajax based app?

Upvotes: 1

Views: 2304

Answers (1)

Denny C
Denny C

Reputation: 11

I'm working on a similar application.

I used to use Oauth via PHP to get the access token. However I recently started using Twitter @Anywhere to generate the access token.

It works similar to Facebook Connect, so once connected via @Anywhere you can go on about your business as usual.

I'm using Javascript only but it sounds like in your case you would just want to point your redirect url to your PHP script.

Upvotes: 1

Related Questions