cube-js/cube

Returning custom HTTP error codes from `check_auth`

已關閉

#8,136 建立於 2024年4月12日

 (9 則留言) (10 個反應) (0 位負責人)Rust (1,965 個分叉)batch import
configurationhelp wanted

倉庫指標

星標
 (19,563 顆星)
PR 合併指標
 (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
    }
}

貢獻者指南