authClient.admin.listUsers() resulting in 401 UNAUTHORIZED

I have
  const { data: users, error } = await authClient.admin.listUsers({
    query: {
      limit: 100,
    },
  });


but for some reason it results in 401. Why? My user def. has Admin

const session = await authClient.getSession()
console.log(session)
  /* 
  {
    "name": "Lennox",
    "email": "XXX@gmail.com",
    "emailVerified": true,
    "image": "https://cdn.discordapp.com/avatars/564190948863508486/37754c72a939961f707f77119b568e9b.png",
    "createdAt": "2025-11-25T20:04:55.817Z",
    "updatedAt": "2025-11-25T20:04:55.817Z",
    "role": "admin",
    "banned": false,
    "banReason": null,
    "banExpires": null,
    "id": "wTh3z9gAnG48Vb4aKZEtAaVq0T0Mq3By"
  }
  */
Was this page helpful?