# SELECT auth.id() = NULL

**URL:** <https://community.weweb.io/t/select-auth-id-null/16440>\
**Category:** Ask us anything\
**Created:** [February 13, 2025, 9:52am UTC](https://community.weweb.io/t/select-auth-id-null/16440 "2025-02-13T09:52:11Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Corner](https://avatars.discourse-cdn.com/v4/letter/c/f0a364/32.png) [@Corner](https://community.weweb.io/u/Corner)\
**Post date:** [February 13, 2025, 9:52am UTC](https://community.weweb.io/t/select-auth-id-null/16440/1 "2025-02-13T09:52:11Z")

</div>

Hello,

When I make the SQL request SELECT auth.id() in the Supabase SQL editor, I get NULL as a result, whereas I’m connected on my Weweb app.

Does someone know why and how to fix it ?

Thanks

---

<div class="post-metadata">

**Author:** ![Broberto](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/broberto/32/5918_2.png) [@Broberto](https://community.weweb.io/u/Broberto)\
**Post date:** [February 13, 2025, 10:52am UTC](https://community.weweb.io/t/select-auth-id-null/16440/2 "2025-02-13T10:52:37Z")

</div>

You need to use impersonation to impersonate the user.

---

<div class="post-metadata">

**Author:** ![Corner](https://avatars.discourse-cdn.com/v4/letter/c/f0a364/32.png) [@Corner](https://community.weweb.io/u/Corner)\
**Post date:** [February 13, 2025, 11:29am UTC](https://community.weweb.io/t/select-auth-id-null/16440/3 "2025-02-13T11:29:27Z")

</div>

Ah … how do you set up impersonation ? 😅

---

<div class="post-metadata">

**Author:** ![Broberto](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/broberto/32/5918_2.png) [@Broberto](https://community.weweb.io/u/Broberto)\
**Post date:** [February 13, 2025, 11:46am UTC](https://community.weweb.io/t/select-auth-id-null/16440/4 "2025-02-13T11:46:44Z")

</div>

![Screenshot 2025-02-13 at 12.46.36](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/8/8323935a7c6bc687375c514ddffb4cf67c7a604d.png)

---

<div class="post-metadata">

**Author:** ![Corner](https://avatars.discourse-cdn.com/v4/letter/c/f0a364/32.png) [@Corner](https://community.weweb.io/u/Corner)\
**Post date:** [February 13, 2025, 11:59am UTC](https://community.weweb.io/t/select-auth-id-null/16440/5 "2025-02-13T11:59:40Z")

</div>

Thank you very much @Broberto. 2 quick questions : why is it not a default set up ? Should I do it individually for every member ?

---

<div class="post-metadata">

**Author:** ![Broberto](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/broberto/32/5918_2.png) [@Broberto](https://community.weweb.io/u/Broberto)\
**Post date:** [February 13, 2025, 12:13pm UTC](https://community.weweb.io/t/select-auth-id-null/16440/6 "2025-02-13T12:13:29Z")

</div>

I honestly don’t know what you’re doing/trying to achieve with this. I’d need to understand that first to be able to answer. I do 1:1 teaching sessions if you’d like to learn more about Supabase/WeWeb - [Consult with Broberto – Broberto](https://broberto.sk/consult)

---

<div class="post-metadata">

**Author:** ![Corner](https://avatars.discourse-cdn.com/v4/letter/c/f0a364/32.png) [@Corner](https://community.weweb.io/u/Corner)\
**Post date:** [February 13, 2025, 2:54pm UTC](https://community.weweb.io/t/select-auth-id-null/16440/7 "2025-02-13T14:54:21Z")

</div>

I’m wanted to create a view to display data based on the auth user, but my SQL statement is not working as it looks like Supabase doesn’t recognize the user as authenticated (I thought it was natively handled by Weweb).

 ![Capture d'écran 2025-02-13 154602](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/f/fdf2aa6719c6f1b9d3060123a755bcc98352e452.png)  
Weweb recognizes when the user is authenticated but apparently not Supabase. But I don’t understand why !

And thanks @Broberto, I will try to look for solutions and if I don’t, I’ll book a session

---

<div class="post-metadata">

**Author:** ![Broberto](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/broberto/32/5918_2.png) [@Broberto](https://community.weweb.io/u/Broberto)\
**Post date:** [February 13, 2025, 4:24pm UTC](https://community.weweb.io/t/select-auth-id-null/16440/8 "2025-02-13T16:24:10Z")

</div>

You should put a policy in RLS in order to gate the content if you wanna have only signed in users to select from a view/table.

---

<div class="post-metadata">

**Author:** ![Corner](https://avatars.discourse-cdn.com/v4/letter/c/f0a364/32.png) [@Corner](https://community.weweb.io/u/Corner)\
**Post date:** [February 13, 2025, 4:38pm UTC](https://community.weweb.io/t/select-auth-id-null/16440/9 "2025-02-13T16:38:08Z")

</div>

yep I did this already.  
I think my only problem is that I didn’t understand that Supabase editor and databases aren’t displaying data regarding current auth users, like not dynamically. Because after publishing my changes, it’s working, I’m getting the right amonts of turnovers in my view !  
Still learning … Thanks @Broberto
