Skip to content

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

Description

@molti-tasking

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions