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.