invocation97
BABetter Auth
•Created by invocation97 on 2/27/2025 in #help
Bearer Authorisation on request time using better-fetch
Hey everyone, I just swapped our custom http client to better fetch, and I am really happy so far. However, I have 2 questions that would save my life:
1. Since the type of app we're building is an admin app which should attach the
Bearer ${access_token}
in 99.99% of the requests, I was wondering if there was a way to use the init
plugin or just the onRequest
hook to attach it without having to call my const session = await auth()
and then to attach the
in each request (as described in the docs). The token
callback function can't be async, so I know i can't attach the header there
2. It's really cool that you provide a logger, but I was wondering if this logger can be used in the app as well, or is it strictly bound to
2 replies
BABetter Auth
•Created by invocation97 on 2/7/2025 in #help
listUsers returns status 401 UNAUTHORIZED even though the current user is an admin.
I am using the
admin()
and adminClient()
plugins while testing out better-auth. I am trying to list out the users using the auth client, but I am getting a 401 unauthorized. I've registered a user and manually changed the role to admin
in the database. I am using nextjs15
Here's the code:
Here are the console logs:
What am I missing? 😅7 replies