Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

docs: update storage rls examples to use auth.jwt() instead of the deprecated auth.uid() (#38929)

Lenny84f9053a3fdb
diff --git a/apps/docs/content/guides/storage/security/access-control.mdx b/apps/docs/content/guides/storage/security/access-control.mdx
index b8c10b4ee51..29b1ce4a1d3 100644
--- a/apps/docs/content/guides/storage/security/access-control.mdx
+++ b/apps/docs/content/guides/storage/security/access-control.mdx
@@ -70,7 +70,7 @@ for insert
to authenticated
with check (
bucket_id = 'my_bucket_id' and
- (storage.foldername(name))[1] = (select auth.uid()::text)
+ (storage.foldername(name))[1] = (select auth.jwt()->>'sub')
);
```
@@ -80,7 +80,7 @@ Allow a user to access a file that was previously uploaded by the same user:
create policy "Individual user Access"
on storage.objects for select
to authenticated
-using ( (select auth.uid()) = owner_id::uuid );
+using ( (select auth.jwt()->>'sub') = owner_id );
```
---