Has anybody gotten the Twitter oAuth flow package to work?

Greetings all and thanks in advance for any replies. I’m new to meteor and shaky legged on oAuth.

My main issue is I can not get the Twitter oAuth flow package to work at all. Before I got submitting issues that probably don’t exist to GitHub, I thought I should ask here first to see what I might be doing wrong.

I am building an app where users can use oAuth to gain access to many different APIs. I decided to start with Twitter, and I added the oAuth packages as well as the Twitter oAuth flow package. I am working out of Cloud9 on a fresh setup of meteor.

Note: I do not want people to login to my app with Twitter. I only want them to use oAuth so they can do REST requests to the Twitter API.

I am so far unable to get the Twitter oAuth flow package to work.

Here is my template helper code where I invoke the oAuth request:

var result = Twitter.requestCredential(function(){
console.log(“success?”);
});

Here is what happens:
The popup window appears, and says unable to connect while it is trying to hit this redirect url:
http://0.0.0.0:8080/_oauth/twitter/...etc

I assumed this was an issue with running on the C9 dev environment so I modified the Twitter client code to remove:

Meteor.absoluteUrl(loginPath);

and instead call:

https://myworkspace.c9.io/_oauth/twitter/?requestTokenAndRedirect=true
+ ‘&state=’ + OAuth._stateParam(loginStyle, credentialToken);

The result is a popup window that simply opens and closes immediately with this in the meteor console:

W20150529-14:54:41.373(0) (oauth_server.js:398) Error in OAuth Server: Failed to send OAuth1 request to https://api.twitter.com/oauth/request_token. failed [401] <?xml version="1.0" encoding="UTF-8"?> Desktop applications only support the oauth_callback value ‘oob’ /oauth/request_token

Finally, just to verify, the loginServiceConfiguration exists and is correct:

meteor:PRIMARY> db.meteor_accounts_loginServiceConfiguration.find() { "_id" : "tQPXeRumnSuSRQAmB", "service" : "twitter", "consumerKey" : "mykeyishere", "secret" : "mysecretishere", "loginStyle" : "popup" }

This is as far as I’ve gotten. Does anybody know what I’m doing wrong, or does it seem like an issue with the package?

Thank you so much!

I got some help out of IRC. I had to do two things:
Set a callback URL in Twitter App management and set the same URL to my ROOT_URL when starting meteor.

Maybe this helps someone else in the future.

Thanks

1 Like