Admin plugin issue

Hello, trying to use banning feature.

Error:
Error banning user: [Error [APIError]: You are not allowed to ban users] {
  status: 'FORBIDDEN',
  body: [Object],
  headers: {},
  statusCode: 403
}


auth.ts
 plugins: [
        adminPlugin({
            defaultRole: AccountRoleEnum.USER,
            adminRoles: [AccountRoleEnum.ADMIN],
        }),
]


action:
await auth.api.banUser({
            body: {
                userId,
                banReason: reason,
                banExpiresIn: duration ? duration * 24 * 60 * 60 : undefined, // Convert days to seconds
            },
            headers: await headers(),
        });


ERROR BODY:
code: 'YOU_ARE_NOT_ALLOWED_TO_BAN_USERS',
message: 'You are not allowed to ban users'
Was this page helpful?