cube-js/cube

Returning custom HTTP error codes from `check_auth`

Open

#8136 aperta il 12 apr 2024

Vedi su GitHub
 (9 commenti) (10 reazioni) (0 assegnatari)Rust (1965 fork)batch import
configurationhelp wanted

Metriche repository

Star
 (19.563 star)
Metriche merge PR
 (Merge medio 5g 16h) (138 PR mergiate in 30 g)

Descrizione

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
    }
}

Guida contributor