cube-js/cube

Returning custom HTTP error codes from `check_auth`

Geschlossen

#8.136 geöffnet am 12.04.2024

 (9 Kommentare) (10 Reaktionen) (0 zugewiesene Personen)Rust (1.965 Forks)batch import
configurationhelp wanted

Repository-Metriken

Stars
 (19.563 Sterne)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

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

Contributor Guide