Admin plugin issue
Hello, trying to use banning feature.
Error:
auth.ts
action:
ERROR BODY:
Error:
Error banning user: [Error [APIError]: You are not allowed to ban users] {
status: 'FORBIDDEN',
body: [Object],
headers: {},
statusCode: 403
}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],
}),
] 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(),
});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'code: 'YOU_ARE_NOT_ALLOWED_TO_BAN_USERS',
message: 'You are not allowed to ban users'