Auth
Auth Admin
User CRUD, invitations, and link generation under supabase.auth.admin.
The auth.admin namespace wraps GoTrue's privileged admin endpoints. Construct a dedicated service-role client and call methods on supabase.auth.admin:
supabase = Supabase.create_client(
supabase_url: ENV.fetch("SUPABASE_URL"),
supabase_key: ENV.fetch("SUPABASE_SERVICE_ROLE_KEY")
)
supabase.auth.admin.list_users(page: 1, per_page: 50)Service-role key required
Every method on auth.admin calls a privileged endpoint that bypasses Row Level Security. The bearer token MUST be a service_role key, not the anon key. Never ship a service-role key to a browser, mobile app, or any client you don't fully control — use it only on a trusted server.
Methods
| Method | Description |
|---|---|
admin.create_user | Create a user directly, bypassing email/phone confirmation. |
admin.list_users | List users with pagination. |
admin.get_user_by_id | Fetch a single user by UUID. |
admin.update_user_by_id | Update any field on any user. |
admin.delete_user | Hard- or soft-delete a user. |
admin.invite_user_by_email | Send an invite email with a signup link. |
admin.generate_link | Generate magic-link, recovery, invite, or signup links without sending the email. |