Twitter Integration with jsOAuth


#1

aaronksaunders / ionic.twitter.sample — Bitbucket http://bit.ly/QnT5jO


#2

Nice job, thanks for sharing this!


#3

Hi @aaronksaunders I tried to run your sample. I have added my key and secret and getting error while requesting for token

"NetworkError: 405 Method Not Allowed - https://api.twitter.com/oauth/request_token"

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://api.twitter.com/oauth/request_token. This can be fixed by moving the resource to the same domain or enabling CORS.

I tried to Enable the CORS but didn’t got success. I am running this app in my local system is it the problem?


#4

I tried to solve CORS problem Using this:

.config(['$httpProvider', function ($httpProvider) {
$httpProvider.defaults.useXDomain = true;
$httpProvider.defaults.headers.common = 'Content-Type: application/json';
delete $httpProvider.defaults.headers.common['X-Requested-With'];

}
]);


#5

Are you testing on device?


#6

No I am testing via browser. Will it going to work on Phone?


#7

I got this to, took me 3h to figure out that if I set something(anything! I used http://argh.com/asd) in the Callback URL in app settings in https://apps.twitter.com/… , it works… :slight_smile:

also, this only works on a device or emulator (why doesnt it work with ionic serve?)

Hopefully this will spare someone a couple of hours!