-
-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for error codes (#855)
Adds support for error codes. All `AuthError` descendants will now have a `code` property which will encode (when present and supported by the server) the reason why the error occurred. To support this, the library will now advertise `X-Supabase-Api-Version: 2024-01-01` which is the first version of a new versioning strategy that supports a different encoding for error responses. See: - supabase/auth#1377
- Loading branch information
Showing
7 changed files
with
299 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/** | ||
* Known error codes. Note that the server may also return other error codes | ||
* not included in this list (if the client library is older than the version | ||
* on the server). | ||
*/ | ||
export type ErrorCode = | ||
| 'unexpected_failure' | ||
| 'validation_failed' | ||
| 'bad_json' | ||
| 'email_exists' | ||
| 'phone_exists' | ||
| 'bad_jwt' | ||
| 'not_admin' | ||
| 'no_authorization' | ||
| 'user_not_found' | ||
| 'session_not_found' | ||
| 'flow_state_not_found' | ||
| 'flow_state_expired' | ||
| 'signup_disabled' | ||
| 'user_banned' | ||
| 'provider_email_needs_verification' | ||
| 'invite_not_found' | ||
| 'bad_oauth_state' | ||
| 'bad_oauth_callback' | ||
| 'oauth_provider_not_supported' | ||
| 'unexpected_audience' | ||
| 'single_identity_not_deletable' | ||
| 'email_conflict_identity_not_deletable' | ||
| 'identity_already_exists' | ||
| 'email_provider_disabled' | ||
| 'phone_provider_disabled' | ||
| 'too_many_enrolled_mfa_factors' | ||
| 'mfa_factor_name_conflict' | ||
| 'mfa_factor_not_found' | ||
| 'mfa_ip_address_mismatch' | ||
| 'mfa_challenge_expired' | ||
| 'mfa_verification_failed' | ||
| 'mfa_verification_rejected' | ||
| 'insufficient_aal' | ||
| 'captcha_failed' | ||
| 'saml_provider_disabled' | ||
| 'manual_linking_disabled' | ||
| 'sms_send_failed' | ||
| 'email_not_confirmed' | ||
| 'phone_not_confirmed' | ||
| 'reauth_nonce_missing' | ||
| 'saml_relay_state_not_found' | ||
| 'saml_relay_state_expired' | ||
| 'saml_idp_not_found' | ||
| 'saml_assertion_no_user_id' | ||
| 'saml_assertion_no_email' | ||
| 'user_already_exists' | ||
| 'sso_provider_not_found' | ||
| 'saml_metadata_fetch_failed' | ||
| 'saml_idp_already_exists' | ||
| 'sso_domain_already_exists' | ||
| 'saml_entity_id_mismatch' | ||
| 'conflict' | ||
| 'provider_disabled' | ||
| 'user_sso_managed' | ||
| 'reauthentication_needed' | ||
| 'same_password' | ||
| 'reauthentication_not_valid' | ||
| 'otp_expired' | ||
| 'otp_disabled' | ||
| 'identity_not_found' | ||
| 'weak_password' | ||
| 'over_request_rate_limit' | ||
| 'over_email_send_rate_limit' | ||
| 'over_sms_send_rate_limit' | ||
| 'bad_code_verifier' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.