cube
cube copied to clipboard
Returning custom HTTP error codes from `check_auth`
Is your feature request related to a problem? Please describe. Return an appropriate response code or even a custom one in the checkAuth function
Describe the solution you'd like
Expose the res
object to manipulate it , or return a 401 http response code
Additional context
module.exports = {
checkAuth: async (req) => {
const token = extractJwt(req);
req.securityContext = await validateAndParseJwt(token);
throw new Error("test"); // this causes cube to return http 500
}
}
If you are interested in working on this issue, please provide go ahead and provide PR for that. We'd be happy to review it and merge it. If this is the first time you are contributing a Pull Request to Cube, please check our contribution guidelines. You can also post any questions while contributing in the #contributors channel in the Cube Slack.
Hi @spljs 👋 I think this makes a lot of sense!
I believe that the solution to this should work equally well with JavaScript-based and Python-based configuration. So, exposing the res
object is less desirable than, say, providing a custom Error/Exception type to raise/throw.
Any Eta?
Hi @haithem-souala 👋
No ETA that I can share.