Open h4ck3rm1k3 opened 9 years ago
exports.OAuthServices.prototype.requestToken = function (req, res) {
var consumerKey = req.body.oauth_consumer_key;
var consumerSecret = req.body.oauth_consumer_secret;
console.log('Request Token: ', consumerKey, consumerSecret);
// Check the consumer key and secret in the database
this.findConsumer(consumerKey, function (err, consumer) {
if (err || !consumer) {
console.error('Invalid Consumer Key:', consumerKey);
return res.status(401).send('Invalid Consumer Key');
}
// Validate the consumer secret
if (consumer.secret !== consumerSecret) {
console.error('Invalid Consumer Secret for Key:', consumerKey);
return res.status(401).send('Invalid Consumer Secret');
}
// Proceed with token generation
// ...
});
};
Using the register app and authorize does not work with the default memory database driver:
The error is that it cannot find the registration. Message is "Invalid Consumer Key" from this method exports.OAuthServices.prototype.requestToken https://github.com/christkv/node-express-oauth-plugin/blob/269aacf76a43da5ef61bc7be50c5bc30ba20b0cf/lib/oauth/oauth_services.js#L117
This goes away if I use the memcached backend.