How can I get a user from an api key ?
Hey all,
I recently stumbled onto better-auth and really like it, especially once I saw it had a plugin for api keys
I managed to get it set up and can create api keys from nuxt (on client side), but I cannot seem to get a user out of them ? I can see the userId is set on the key (since it's created from an authenticated user), but if I try to get a user out of the session by doing this:
But it turns out as undefined:
I send the request with a header of
Did I misread the docs ? Have I missed something ?
How are you all doing this ?
I recently stumbled onto better-auth and really like it, especially once I saw it had a plugin for api keys
I managed to get it set up and can create api keys from nuxt (on client side), but I cannot seem to get a user out of them ? I can see the userId is set on the key (since it's created from an authenticated user), but if I try to get a user out of the session by doing this:
But it turns out as undefined:
I send the request with a header of
x-api-key : <value> where <value> is the value of the generate apiKey.key.Did I misread the docs ? Have I missed something ?
How are you all doing this ?
Solution
Ok, it just seems like I cannot copy/paste correctly into a curl command. Nothing to see here xD