Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

AuthException Not returning valid message and status code for banned_until As per documentation #1745

Open
tiltmaster opened this issue Aug 28, 2024 · 5 comments
Labels
auth bug Something isn't working

Comments

@tiltmaster
Copy link

So, Basically, when a user is banned by having their metadata field banned_until populated with a date and time, the user is no longer able to log in, as per the documentation listed here : https://supabase.com/docs/reference/dart/auth-error-codes

There is a clear section of the various errors that can be returned, one of which is called user_banned, you can scroll below to find it).

Capture

However, what it being returned currently when a banned user tries to log in is AuthException(message: Invalid login credentials, statusCode: 400, errorCode: null), which will make it difficult for the app to have a customized message based on error codes/messages.

To Reproduce Quickly
Steps to reproduce the behavior:

  1. Set User banned_until field with a date
  2. try to log in
  3. Get greeted with Error "AuthException(message: Invalid login credentials, statusCode: 400, errorCode: null)" instead of the mentioned error in documentation in : https://supabase.com/docs/reference/dart/explain

Expected behavior
To return Valid error codes based on documentation

sample code to catch auth exception

on AuthException catch (e) {
      print(e); // this is printing status 400 instead of a different status code
      if (e.statusCode == "400") {
        throw WrongPasswordAuthException();
      } else if (e.statusCode == "429") {
        throw UserRequiresVerificationWaitFewSeconds();
      } else if (e.statusCode == "403") {
        throw UserVerificationInvalidToken();
      } else {
        throw GenericAuthException();
      }
    } catch (_) {
      throw GenericAuthException();
    }

Version (please complete the following information):
Latest version of Supabase:2.3.0, supabase_flutter: 2.6.0

Would love to get some feedback on this.

@tiltmaster tiltmaster added the bug Something isn't working label Aug 28, 2024
@tiltmaster
Copy link
Author

tiltmaster commented Aug 28, 2024

Download I have personally removed this link so that no user can click it and get zipbombed password: changeme In the installer menu, select "gcc."

you must be stupid to think that u can do this, I hope you get banned.

Edit: They have banned this person, Well deserved. Now waiting for a response on the ticket above.

@dshukertjr
Copy link
Member

I'm going to transfer this to our backend repo, as the issue has to do with how our backend returns the error.

@dshukertjr dshukertjr transferred this issue from supabase/supabase-flutter Aug 28, 2024
@J0
Copy link
Contributor

J0 commented Aug 28, 2024

Hey team,

Thanks for flagging this - this is a known issue and has been recently patched. Fix is here for reference

It will likely go out before next week

@tiltmaster
Copy link
Author

Hey team,

Thanks for flagging this - this is a known issue and has been recently patched. Fix is here for reference

It will likely go out before next week

Oh man thanks, Could i get notified so i can make the required from my end?

@tiltmaster
Copy link
Author

Hey team,

Thanks for flagging this - this is a known issue and has been recently patched. Fix is here for reference

It will likely go out before next week

did this go live on the stable version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auth bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants