cube-js/cube

Returning custom HTTP error codes from `check_auth`

Open

#8,136 opened on 2024年4月12日

GitHub で見る
 (9 comments) (10 reactions) (0 assignees)Rust (1,965 forks)batch import
configurationhelp wanted

Repository metrics

Stars
 (19,563 stars)
PR merge metrics
 (平均マージ 5d 16h) (30d で 138 merged PRs)

説明

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

コントリビューターガイド