1

I want to enable oauth login with twitter. I added the following code for everyauth in server.js

everyauth
  .twitter
  .consumerKey('mykey')
  .consumerSecret('mysecret')
  .findOrCreateUser(function (sess, accessToken, accessSecret, twitUser) {
    return usersByTwitId[twitUser.id] || (usersByTwitId[twitUser.id] = addUser('twitter', twitUser));
})
.redirectPath('/about');

where 'mykey' and 'mysecret' are the correspoding of my twitter app. The settings in my twitter app are:

Access level: Read and write 
             About the application permission model

Consumer key: mykey
Consumer secret: mysecret
Request token URL: https://api.twitter.com/oauth/request_token 
Authorize URL: https://api.twitter.com/oauth/authorize 
Access token URL: https://api.twitter.com/oauth/access_token 
Callback URL: http://192.168.1.197:8002/ 
Sign in with Twitter: Yes 

The problem is after correct loging, the web stays in 'https://api.twitter.com/oauth/authenticate' and doesn't redirect to my callback url

What could be wrong?

UPDATE: now I'm getting one of the following errors...

{"errors": [{"message": "The Twitter REST API v1 is no longer active. 
Please migrate to API v1.1. https://dev.twitter.com/docs/api/1.1/overview.", "code": 68}]}

I really don't know how to update to version 1.1. I tried some solutions from the dev twitter forum but nothing.

500 Error: Step rememberTokenSecret of `twitter` is promising: 
requestTokenSecret ;     however, the step returns nothing. 
Fix the step by returning the expected values OR by returning a Promise 
that promises said values.

MORE INFO I updated everyauth and twitter api. I check the file twitter.js in the everyauth's node_module folder ...

.fetchOAuthUser( function (accessToken, accessTokenSecret, params) {
  var promise = this.Promise();
this.oauth.get(this.apiHost() + '/1.1/users/show.json?user_id=' + params.user_id, accessToken, accessTokenSecret, function (err, data, res) {
  if (err) {
    err.extra = {data: data, res: res};
    return promise.fail(err);
  }
  var oauthUser = JSON.parse(data);
  promise.fulfill(oauthUser);
});
return promise;
})

... Thank you.

blfuentes
  • 2,731
  • 5
  • 44
  • 72
  • I've not worked with Twitter auth, but with others you usually have to also specify the callback URL in your app setup as well (typically the same screen that gives you your key and secret). Is your callback URL set there as well? – MikeSmithDev Nov 20 '13 at 15:58
  • I think so, you can see I wrote Callback URL:http://192.168.1.197:8002/, I dont know if I should add something different. – blfuentes Nov 20 '13 at 16:01
  • Is your version of `everyauth` up-to-date? It seems it is still using the deprecated Twitter api v1.0 – maxdec Nov 21 '13 at 08:44
  • 1
    I updated twitter api and everyauth module, but still getting the same errors – blfuentes Nov 21 '13 at 09:04

0 Answers0