Are there any node module that can compete with passportJS. Something that can provide oauth1, oauth2, local and basic authentication?
I've been trying to login to wordpress using wordpress API. I managed to login successfully using oauth2 but wordpress api dont recognize my credentials when trying to post. Wordpress API gave me an access token and request token, so this shows that wordpress allow my access.
{
"message": "Successfully fetched profile",
"user": {
"_id": "5947b48f1befbd29f82fcffe",
"refreshToken": "th21j1gpn4ybtiphxi3exfjys4j7g8gnbdfwguil",
"accessToken": "mi8vbwlosv0gbbr4mokc1gvwixqwuvwmc7cefluq",
"__v": 0
}
}
I also tried oauth1 but node keep giving me a "Failed to obtain request token error". I've check the keys and secret like twenty times but still this error.
passport.use(new OAuth1Strategy({
requestTokenURL : configAuth.oauth1.requestTokenURL,
userAuthorizationURL: configAuth.oauth1.userAuthorizationURL,
accessTokenURL : configAuth.oauth1.accessTokenURL,
consumerKey : configAuth.oauth1.consumerKey,
consumerSecret : configAuth.oauth1.consumerSecret,
callbackURL : configAuth.oauth1.callbackURL,
signatureMethod : configAuth.oauth1.signatureMethod
}, (accessToken, refreshToken, profile, done) => {
process.nextTick(() => {
BlogUser.findOne({ 'id': profile.id }, (err, user) => {
if (err)
return done(err);
if (user) {
return done(null, user); // user found, return that user
} else {
var newBlogUser = new BlogUser();
newBlogUser.id = profile.id;
newBlogUser.accessToken = accessToken;
newBlogUser.refreshToken = refreshToken;
// save our user to the database
newBlogUser.save(err => {
if (err){
console.log(err);
throw err;
}
// if successful, return the new user
return done(null, newBlogUser);
});
}
});
});
}
));
Then here's keys
'oauth1' : {
'requestTokenURL': 'http://samplesite.com/oauth1/request',
'userAuthorizationURL':'http://samplesite.com/oauth1/authorize',
'accessTokenURL': 'http://samplesite.com/oauth1/access',
'consumerKey': '5K1Zld******',
'consumerSecret': 'egTJf2ct3NDzzmEPrXP***************************',
'callbackURL': 'http://127.0.0.1:3003/auth/wordpress/callback',
'signatureMethod': 'HMAC-SHA1'
},
I want to try different modules other than passport to see if I will get the same error with oauth.