cube-js/cube

Returning custom HTTP error codes from `check_auth`

Open

#8,136 创建于 2024年4月12日

在 GitHub 查看
 (9 评论) (10 反应) (0 负责人)Rust (1,965 fork)batch import
configurationhelp wanted

仓库指标

Star
 (19,563 star)
PR 合并指标
 (平均合并 5天 16小时) (30 天内合并 138 个 PR)

描述

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

贡献者指南