Supabase Auth: The role of admin with user metadata does not protect API
The application recognises the user metadata.role value given by the client as the administrator's permission.
How to identify the source of the problem
Check whether the user can change the user metadata himself and whether endpoint trusts these fields.
Compare the result for the authorized and unauthorised user, project name and exact error code.
Repair steps
Move roles to a secure table or controlled claims managed on the server side.
How to Test Solution
Changing your own profile does not give you the ability to manage other users.
Security and restrictions
Change permissions and scheme first on test data with backup. Do not put service role in your browser.