admin plugin ban user - unauthorized

How do I ban a user in a server side route? Thought thats the way how you perform actions on the server side
await auth.api.banUser({
body: {
userId: input.id,
banReason: 'Your account has been deleted and is no longer available.',
},
});
await auth.api.banUser({
body: {
userId: input.id,
banReason: 'Your account has been deleted and is no longer available.',
},
});
But this just throws an error when it's being executed:
[Error [APIError]: ] {
status: 'UNAUTHORIZED',
body: undefined,
headers: {},
statusCode: 401
}
[Error [APIError]: ] {
status: 'UNAUTHORIZED',
body: undefined,
headers: {},
statusCode: 401
}
Solution:
provide headers, UNAUTHORIZED status is when you dont provide any authorization in your request
No description
Jump to solution
1 Reply
Solution
Certurix
Certurix2w ago
provide headers, UNAUTHORIZED status is when you dont provide any authorization in your request
No description

Did you find this page helpful?