diff --git a/src/routes/(public)/auth/oauth2/failure/+page.svelte b/src/routes/(public)/auth/oauth2/failure/+page.svelte index df84e3a46..5ab80ecaf 100644 --- a/src/routes/(public)/auth/oauth2/failure/+page.svelte +++ b/src/routes/(public)/auth/oauth2/failure/+page.svelte @@ -3,11 +3,27 @@ import { Typography } from '@appwrite.io/pink-svelte'; const project = page.url.searchParams.get('project'); + const errorParam = page.url.searchParams.get('error'); const link = `appwrite-callback-${project}://${page.url.search}`; + type OAuthError = { + message?: string; + type?: string; + code?: number; + }; + + let oauthError: OAuthError | null = null; + if (errorParam) { + try { + oauthError = JSON.parse(errorParam) as OAuthError; + } catch { + oauthError = { message: errorParam }; + } + } + const redirect = new Promise((_resolve, reject) => { if (!project) { - reject('no-project'); + reject(oauthError ? 'oauth-error' : 'no-project'); } window.location.href = link; }); @@ -27,15 +43,25 @@ {:catch}
- Missing redirect URL -

- Your OAuth login flow is missing a proper redirect URL. Please check the - OAuth docs - and send request for new session with a valid callback URL. -

+ {#if oauthError} + Login failed +

+ {oauthError.message ?? 'An error occurred during the OAuth login flow.'} +

+ {#if oauthError.type} +

Error type: {oauthError.type}

+ {/if} + {:else} + Missing redirect URL +

+ Your OAuth login flow is missing a proper redirect URL. Please check the + OAuth docs + and send request for new session with a valid callback URL. +

+ {/if}
{/await}