---
title: "Discussion on \"Using custom claims & testing RLS with Supabase\" | Hashnode"
description: "Discussion on \"Using custom claims & testing RLS with Supabase\". Learn how to implement custom claims and test row-level security (RLS) with Supabase and PostgreSQL. Improve the efficiency of your access control rules."
url: "https://hashnode.com/posts/using-custom-claims-testing-rls-with-supabase/642461a46185c44a622138c7"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Using custom claims & testing RLS with Supabase](https://blog.mansueli.com/using-custom-claims-testing-rls-with-supabase?utm_source=hashnode&utm_medium=feed)

Learn how to implement custom claims and test row-level security (RLS) with Supabase and PostgreSQL. Improve the efficiency of your access control rules.

Mar 29, 2023 · 5 min read · blog.mansueli.com  
Updated Sep 25, 2023  
Read the article

-   [#json](https://hashnode.com/tag/json)
-   [#postgresql](https://hashnode.com/tag/postgresql)
-   [#supabase](https://hashnode.com/tag/supabase)
-   [#debugging](https://hashnode.com/tag/debugging)
-   [#row-level-security](https://hashnode.com/tag/row-level-security)

## Written by

[Rodrigo Mansueli](https://hashnode.com/@mansueli)

@mansueli

  
[View profile](https://hashnode.com/@mansueli)

Supabase Tips

Support Engineer @Supabase | StackOverflow

## Responses 2

Markdown supported · ⌘↵ to post

[Anton](https://hashnode.com/@magick)

[Sep 22, 2023](https://hashnode.com/posts/using-custom-claims-testing-rls-with-supabase/642461a46185c44a622138c7/comment/650d23b9939d972b9932436f)

There seems to be a few essential details missing. What does the `company` string in the policy refer to? And how is the custom claim(s) added to the `raw_user_meta_data`?

[Rodrigo Mansueli](https://hashnode.com/@mansueli)

[Sep 22, 2023](https://hashnode.com/posts/using-custom-claims-testing-rls-with-supabase/642461a46185c44a622138c7/comment/650d23b9939d972b9932436f#reply-650d8fdbf92a4f31b4653c6e)

There was a refactor to change from `company` to `team` and I missed that the screenshot was outdated. I've updated the article to explain this more in-depth. Including setting the claim for a user and how the metadata looks like.

[Anton](https://hashnode.com/@magick)

[Sep 22, 2023](https://hashnode.com/posts/using-custom-claims-testing-rls-with-supabase/642461a46185c44a622138c7/comment/650d23b9939d972b9932436f#reply-650dff7f59ede531e43ef326)

Thanks [Rodrigo Mansueli](https://hashnode.com/@mansueli). BTW - I'm a big fan of your articles. They are a fantastic resource!

[Chris](https://hashnode.com/@smollito)

[Sep 2, 2023](https://hashnode.com/posts/using-custom-claims-testing-rls-with-supabase/642461a46185c44a622138c7/comment/64f2d54fee6c557cc673cea2)

great article. Thanks!
