PostgREST has an interesting approach to authentication that might give you some ideas:
https://postgrest.org/en/stable/auth.html
Supabase is built on top of PostgREST, but I can’t say for sure it uses the same means of authentication (I think it has its own Auth layer).