auth icon indicating copy to clipboard operation
auth copied to clipboard

Have a way to reliably know if a user is banned or not

Open groud opened this issue 2 years ago • 0 comments

Bug report

  • [x] I confirm this is a bug with Supabase, not with my own application.
  • [x] I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

So, I am not sure it can be considered as a bug, but it kind of makes one of gotrue's feature hard to use without workarounds. My goal is to know which users are banned out of the list provided by listUsers. Right now, it returns a banned_until field with a date & time value. This field does not get automatically cleaned up when the time is passed, so I need to check this date on the client's side.

The problem is that the client's date & time might not be perfectly in-sync with the supabase instance's one, which may make some users appear as banned while they are not anymore, or the other way around. This is problematic on my side, as it means I cannot reliably know if a user is banned or not.

To solve this problem, I either gotrue could be modified to remove the banned_until field automatically, or return another boolean value to give the actual ban status. But if we don't want that, gotrue-js could be simply modified to let users access the response headers, since the response headers contain the servers's date.

Expected behavior

Have a way to reliably know if a user is banned or not.

System information

  • OS: Linux
  • Version of supabase-js: 2.25.0

Additional context

I am willing to help solving to solve this issue, if you want me to open a PR to solve the issue, please let me know.

groud avatar Jun 14 '23 09:06 groud