Protect API routes #68

Closed
opened 2026-03-13 07:30:51 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @moshetanzer on GitHub (Oct 12, 2024).

Hi,

How do you protect api routes in nuxt use better auth? Also can you do it using rbac?

Originally created by @moshetanzer on GitHub (Oct 12, 2024). Hi, How do you protect api routes in nuxt use better auth? Also can you do it using rbac?
Author
Owner

@Bekacru commented on GitHub (Oct 13, 2024):

You can secure it by checking the session with auth.api.getSession. For RBAC, you can use the organization plugin. If you only need admin and user roles, you can also just use the admin plugin or define custom fields instead.

@Bekacru commented on GitHub (Oct 13, 2024): You can secure it by checking the session with `auth.api.getSession`. For RBAC, you can use the `organization` plugin. If you only need `admin` and `user` roles, you can also just use the admin plugin or define custom fields instead.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#68