Search code examples
supabase

Supabase Policy Using auth.jwt() Helper


The Supabase Policy docs show the auth.jwt() helper is available. In the examples, they show retrieving the email (auth.jwt() ->> 'email' here). Is it possible to access the app or user metadata properties from auth.jwt() ? If so, what's the syntax for accessing child properties?

I've tried dot notation without success.


Solution

  • You can access the meta data like this. This is the syntax for accessing json values in postgres.

    auth.jwt() -> 'user_metadata' ->> 'my_property'