How to Ensure Organization List API is authorized
I'm currently trying to use Better Auth and pair it with TanStack Query to optimize request caching as I want to dedupe multiple of the same requests that I see firing in my application.
The question I have is, instead of using the
client.useListOrganizations
hook API that the docs recommend, I am using the raw client.organization.list
API and wrapping that within the TanStack Query function like so:
The issue is, after signing in via email using the Better Auth client, invoking that list API call results in me receiving at 401 Not Authorized response.
Can someone point to me what I'm missing to get that API to work properly after having the Better Auth cookies set properly post sign in?1 Reply
You need to pass
headers