diff --git a/apps/docs/docs/ref/shared/auth-error-codes.mdx b/apps/docs/components/MDX/auth_error_codes_table.mdx similarity index 94% rename from apps/docs/docs/ref/shared/auth-error-codes.mdx rename to apps/docs/components/MDX/auth_error_codes_table.mdx index 06e63a9fb24..cb6a3c591b9 100644 --- a/apps/docs/docs/ref/shared/auth-error-codes.mdx +++ b/apps/docs/components/MDX/auth_error_codes_table.mdx @@ -1,14 +1,3 @@ -Supabase Auth can throw or return various errors when using the API. All errors originating from the `supabase.auth` namespace of the JavaScript client library will be wrapped by the `AuthError` class. - -Error objects are split in a few classes: - -- `AuthApiError` -- errors which originate from the Supabase Auth API. - - Use `isAuthApiError` instead of `instanceof` checks to see if an error you caught is of this type. -- `CustomAuthError` -- errors which generally originate from state in the client library. - - Use the `name` property on the error to identify the class of error received. - -Errors originating from the server API classed as `AuthApiError` always have a `code` property that can be used to identify the error returned by the server. The `status` property is also present, encoding the HTTP status code received in the response. - In general the HTTP status codes you will likely receive are: - [403 Forbidden](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403) is sent out in rare situations where a certain Auth feature is not available for the user, and you as the developer are not checking a precondition whether that API is available for the user. @@ -77,7 +66,7 @@ To supplement HTTP status codes, Supabase Auth returns a string error code which | `sso_domain_already_exists` | (Admin API.) Only one SSO domain can be registered per SSO identity provider. | | `sso_provider_not_found` | SSO provider not found. Check the arguments in `supabase.auth.signInWithSSO()`. | | `too_many_enrolled_mfa_factors` | A user can only have a fixed number of enrolled MFA factors. | -| `unexpected_audience` | (Deprecated feature not available via Supabase JavaScript client.) The request's `X-JWT-AUD` claim does not match the JWT's audience. | +| `unexpected_audience` | (Deprecated feature not available via Supabase client libraries.) The request's `X-JWT-AUD` claim does not match the JWT's audience. | | `unexpected_failure` | Auth service is degraded or a bug is present, without a specific reason. | | `user_already_exists` | User with this information (email address, phone number) cannot be created again as it already exists. | | `user_banned` | User to which the API request relates has a `banned_until` property which is still active. No further API requests should be attempted until this field is cleared. | @@ -85,8 +74,3 @@ To supplement HTTP status codes, Supabase Auth returns a string error code which | `user_sso_managed` | When a user comes from SSO, certain fields of the user cannot be updated (like `email`). | | `validation_failed` | Provided parameters are not in the expected format. | | `weak_password` | User is signing up or changing their password without meeting the password strength criteria. Use the `AuthWeakPasswordError` class to access more information about what they need to do to make the password pass. | - -### Tips for better error handling - -- Do not use string matching on error messages! Always use the `name` and `code` properties of error objects to identify the situation. -- Although HTTP status codes generally don't change, they can suddenly change due to bugs, so avoid relying on them unless absolutely necessary. diff --git a/apps/docs/components/Navigation/NavigationMenu/NavigationMenuRefList.tsx b/apps/docs/components/Navigation/NavigationMenu/NavigationMenuRefList.tsx index 9725daa229b..af0c26b8050 100644 --- a/apps/docs/components/Navigation/NavigationMenu/NavigationMenuRefList.tsx +++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenuRefList.tsx @@ -28,6 +28,12 @@ const NavigationMenuRefList = ({ } const filteredSections = commonSections.filter((section) => { + if (section.type === 'category') { + section.items = section.items.filter((item) => { + return !item.excludes?.includes(id) + }) + } + return !section.excludes?.includes(id) }) diff --git a/apps/docs/components/index.tsx b/apps/docs/components/index.tsx index c3fc9b95741..6a692f8dddd 100644 --- a/apps/docs/components/index.tsx +++ b/apps/docs/components/index.tsx @@ -35,6 +35,7 @@ import { SharedData } from './SharedData' // Partials import HuggingFaceDeployment from './MDX/ai/quickstart_hf_deployment.mdx' +import AuthErrorCodesTable from './MDX/auth_error_codes_table.mdx' import AuthRateLimits from './MDX/auth_rate_limits.mdx' import DatabaseSetup from './MDX/database_setup.mdx' import GetSessionWarning from './MDX/get_session_warning.mdx' @@ -90,6 +91,7 @@ const components = { ), AppleSecretGenerator, AuthProviders, + AuthErrorCodesTable, AuthRateLimits, AuthSmsProviderConfig, Button, diff --git a/apps/docs/components/reference/Reference.types.ts b/apps/docs/components/reference/Reference.types.ts index 1a52db858b2..ea25597af29 100644 --- a/apps/docs/components/reference/Reference.types.ts +++ b/apps/docs/components/reference/Reference.types.ts @@ -53,9 +53,6 @@ export interface ICommonCategory extends ICommonBase { export interface ICommonMarkdown extends ICommonBaseSection { type: 'markdown' - meta?: { - shared?: boolean - } } export interface ICommonFunctionGroup extends ICommonBaseSection { diff --git a/apps/docs/docs/ref/javascript/auth-error-codes.mdx b/apps/docs/docs/ref/javascript/auth-error-codes.mdx new file mode 100644 index 00000000000..599bd09e5e0 --- /dev/null +++ b/apps/docs/docs/ref/javascript/auth-error-codes.mdx @@ -0,0 +1,17 @@ +Supabase Auth can throw or return various errors when using the API. All errors originating from the `supabase.auth` namespace of the client library will be wrapped by the `AuthError` class. + +Error objects are split in a few classes: + +- `AuthApiError` -- errors which originate from the Supabase Auth API. + - Use `isAuthApiError` instead of `instanceof` checks to see if an error you caught is of this type. +- `CustomAuthError` -- errors which generally originate from state in the client library. + - Use the `name` property on the error to identify the class of error received. + +Errors originating from the server API classed as `AuthApiError` always have a `code` property that can be used to identify the error returned by the server. The `status` property is also present, encoding the HTTP status code received in the response. + + + +### Tips for better error handling + +- Do not use string matching on error messages! Always use the `name` and `code` properties of error objects to identify the situation. +- Although HTTP status codes generally don't change, they can suddenly change due to bugs, so avoid relying on them unless absolutely necessary. diff --git a/apps/docs/docs/ref/kotlin/auth-error-codes.mdx b/apps/docs/docs/ref/kotlin/auth-error-codes.mdx new file mode 100644 index 00000000000..69ff9aacb66 --- /dev/null +++ b/apps/docs/docs/ref/kotlin/auth-error-codes.mdx @@ -0,0 +1,17 @@ +Supabase Auth can throw or return various errors when using the API. All errors originating from the `supabase.auth` namespace of the JavaScript client library will be wrapped by the `AuthError` class. + +Error objects are split in a few classes: + +- `AuthApiError` -- errors which originate from the Supabase Auth API. + - Use `isAuthApiError` instead of `instanceof` checks to see if an error you caught is of this type. +- `CustomAuthError` -- errors which generally originate from state in the client library. + - Use the `name` property on the error to identify the class of error received. + +Errors originating from the server API classed as `AuthApiError` always have a `code` property that can be used to identify the error returned by the server. The `status` property is also present, encoding the HTTP status code received in the response. + + + +### Tips for better error handling + +- Do not use string matching on error messages! Always use the `name` and `code` properties of error objects to identify the situation. +- Although HTTP status codes generally don't change, they can suddenly change due to bugs, so avoid relying on them unless absolutely necessary. diff --git a/apps/docs/lib/mdx/generateRefMarkdown.tsx b/apps/docs/lib/mdx/generateRefMarkdown.tsx index bda0debbe01..165783822ba 100644 --- a/apps/docs/lib/mdx/generateRefMarkdown.tsx +++ b/apps/docs/lib/mdx/generateRefMarkdown.tsx @@ -17,8 +17,7 @@ async function generateRefMarkdown(sections: ICommonMarkdown[], slug: string) { */ await Promise.all( sections.map(async (section) => { - const isSharedSection = section.meta?.shared - const pathName = `docs/ref${isSharedSection ? '/shared' : slug}/${section.id}.mdx` + const pathName = `docs/ref${slug}/${section.id}.mdx` function checkFileExists(x) { if (fs.existsSync(x)) { diff --git a/apps/docs/spec/common-client-libs-sections.json b/apps/docs/spec/common-client-libs-sections.json index 77fc096242d..9360b867298 100644 --- a/apps/docs/spec/common-client-libs-sections.json +++ b/apps/docs/spec/common-client-libs-sections.json @@ -404,9 +404,13 @@ "title": "Error codes", "slug": "auth-error-codes", "type": "markdown", - "meta": { - "shared": true - } + "excludes": [ + "reference_dart_v1", + "reference_dart_v2", + "reference_python_v2", + "reference_swift_v1", + "reference_swift_v2" + ] }, { "id": "sign-up", @@ -1012,4 +1016,4 @@ } ] } -] +] \ No newline at end of file