supabase / auth-js

An isomorphic Javascript library for Supabase Auth.
MIT License
319 stars 152 forks source link

feat: add filter support to listUsers #865

Open 0x62 opened 3 months ago

0x62 commented 3 months ago

What kind of change does this PR introduce?

There is already support for a filter=xyz query param for the listUsers endpoint, but it is not exposed on the client. This PR adds support for the filter, which allows users to filter the respond of listUsers by a partial or full email address.

This PR also fixes pagination metadata for page values >9. This was originally proposed in #793, but changes were requested and that PR is now stale so I have implemented those changes here too.

What is the current behavior?

It is not possible to filter users via the SDK.

What is the new behavior?

You can now filter users.

Additional context

https://github.com/supabase/gotrue/issues/880

0x62 commented 2 months ago

@kangmingtay any chance you could review this?

I came from https://github.com/supabase/auth/pull/1330#issuecomment-1848007008, but discovered there is no way to actually use this endpoint from the SDK

hi @JKFSOM, thanks for taking the time to contribute but i don't think we'll be adding this endpoint in - the GET /admin/users endpoint actually allows you to filter for a user's email address already:

for example:

curl -X GET "http://localhost:9999/admin/users?filter=<user_email_address>" -H "Authorization: Bearer ADMIN_JWT"