Category: Supabase and databases

Supabase Auth: getSession is not enough to check your permissions

Read this guide in Polish

Endpoint accepts the session read with cookies as the final identity card.

How to identify the source of the problem

Check that the server authenticates the user, or only trusts the session stored on the client side.

Compare the result for the authorized and unauthorised user, project name and exact error code.

Repair steps

In trusted operations, verify the user with the Auth method.

How to Test Solution

The inserted session does not allow the operation to be performed, and the correct user undergoes control.

Security and restrictions

Change permissions and scheme first on test data with backup. Do not put service role in your browser.