Middleware not working?
Hi all,
i guess i have a very common use case. but as i am new to better auth maybe you can give me some hints.
Stack T3 Stack with better-auth, drizzle, trpc.
Usecase:
my app is a "backendonly" app which means that only the loginform is shown to the public.
next is: my users can have 2 different roles "user" and "admin"
any user has to login before he can see something.
middleware.ts
but i get this error when im logged in:
i already tried as well to add the runtime, but i get another error
so im thinking that it is not the preferrable way to protect routes.
can you give me some hints how to solve or implement such usecases.
is it better to write or use plugins?
i guess i have a very common use case. but as i am new to better auth maybe you can give me some hints.
Stack T3 Stack with better-auth, drizzle, trpc.
Usecase:
my app is a "backendonly" app which means that only the loginform is shown to the public.
next is: my users can have 2 different roles "user" and "admin"
any user has to login before he can see something.
- /page.tsx => Loginform
- /user/page.tsx => Protected Userpage
- /admin/page.tsx => Protected Adminpage
middleware.ts
but i get this error when im logged in:
i already tried as well to add the runtime, but i get another error
so im thinking that it is not the preferrable way to protect routes.
can you give me some hints how to solve or implement such usecases.
is it better to write or use plugins?