Sekai
04/21/2023, 5:43 PMif (roles === undefined || !roles.includes("admin")) {
// this error tells SuperTokens to return a 403 to the frontend.
await superTokensNextWrapper(
async (_next) => {
throw new STError({
type: "INVALID_CLAIMS",
message: "User is not an admin",
payload: [{
id: UserRoles.UserRoleClaim.key
}]
})
},
req,
res
)
}
// if it comes here, it means that the session verification was successful
I set the message to message: "User is not an admin"
but the api returns message: "invalid claim"
Also is there anyway to control the error handling so that instead of SuperTokens returning 403 to the frontend I return my own error to be more specific I am using SWR and hope to get the error from there somehow
https://cdn.discordapp.com/attachments/644849840475602944/1099027702931005570/image.png▾
rp
04/22/2023, 6:11 AM