@feathersjs/authentication-oauth1
Version:
A Feathers OAuth1 authentication strategy
12 lines (10 loc) • 424 B
JavaScript
module.exports = function OAuthErrorHandler (options = {}) {
return function (err, req, res, next) {
// Set __redirect so that later middleware (e.g., auth.express.failureRedirect) can redirect accordingly
if (options.failureRedirect) {
res.hook = { data: {} };
Object.defineProperty(res.hook.data, '__redirect', { value: { status: 302, url: options.failureRedirect } });
}
next(err);
};
};