Anyway to access admin API from server?

I seem to be getting a 401 error on calling my auth API endpoints from my server await auth.api.listUsers({ query: { limit: 10, }, }) admin:dev: [Error [APIError]: ] { admin:dev: status: 'UNAUTHORIZED', admin:dev: body: undefined, admin:dev: headers: {}, admin:dev: statusCode: 401 admin:dev: }
2 Replies
Platon
PlatonOP18h ago
If it helps at all, I'm attempting this in a monorepo setup where my services/better-auth are in a package, and I'm importing it into a nextjs page in an app
KiNFiSH
KiNFiSH12h ago
do you have a valid session or header ? if you do have a valid header pass it an options with listUsers()

Did you find this page helpful?