Skip to content

403 Forbidden

You are logged in, but you don’t have permission to access this specific resource or perform this action.

Use this when the user IS logged in, but they are trying to do something they have no business doing. Like a normal user trying to access the admin dashboard, or trying to edit someone else’s profile.

import { HttpException, del } from 'shokupan';
export const deleteUser = del('/users/:id', (req) => {
// Assuming auth checked earlier, yielding req.user
if (req.user.role !== 'admin') {
throw new HttpException('Admins only', 403);
}
// ... delete user securely
});