Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix testing of Supabase Anonymous Sign-Ins: Include is_anonymous field of user on jwt for authenticate_as functions #25

Open
molti-tasking opened this issue Mar 6, 2025 · 0 comments

Comments

@molti-tasking
Copy link

First of all: Great package, thanks you so much!! I have built many, many tests with these helpers 😃

When testing anonymous users in supabase the RLS policies rely on the is_anonymous field in the jwt:

select (auth.jwt()->>'is_anonymous')::boolean

Please, refer to the supabase docs for more information on anonymous users: https://supabase.com/docs/guides/auth/auth-anonymous?queryGroups=language&language=js#access-control

In the end the problem is in the "authenticate_as" function, because there are some fields mapped to the jwt claims, but the is_anonymous field is missing. Adding it should solve this issue and the supabase-test-helpers should be sufficient for supabase RLS testing.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant