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

Handle weak_password and session_not_found auth error codes #596

Merged
merged 4 commits into from
May 21, 2024

Conversation

jan-tennert
Copy link
Collaborator

What kind of change does this PR introduce?

Feature (closes #592)

What is the current behavior?

No API error is handled internally.

What is the new behavior?

The error codes weak_password and session_not_found now get handled internally. Both throw their own exception (from the base class AuthRestException), the first one includes the reasons and the second causes the session to be cleared.

@jan-tennert jan-tennert added enhancement New feature or request auth labels May 15, 2024
@jan-tennert jan-tennert self-assigned this May 15, 2024
@jan-tennert jan-tennert requested a review from dshukertjr May 16, 2024 10:54
Copy link
Member

@dshukertjr dshukertjr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick response!

@grdsdev
Copy link
Contributor

grdsdev commented May 16, 2024

Hi @jan-tennert not sure if you're aware but this error codes are part of a bigger initiative, maybe you wan't to add overall support for error codes before merging this?

Check supabase/auth-js#855

@jan-tennert
Copy link
Collaborator Author

jan-tennert commented May 16, 2024

Do you mean checking for the API version? Currently, a pretty generic exception gets thrown like BadRequestRestException which does include the error_code for Auth API errors. This is PR is basically just on top of the existing implementation. We could also create an enum for all known error codes.

@jan-tennert jan-tennert requested a review from grdsdev May 20, 2024 16:44
@jan-tennert
Copy link
Collaborator Author

Going to merge this for now.

@jan-tennert jan-tennert merged commit 0ce064c into master May 21, 2024
8 checks passed
@jan-tennert jan-tennert deleted the auth-exceptions branch June 12, 2024 06:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auth enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature request]: remove session, emit SIGNED_OUT when JWT session_id is invalid
3 participants