From d4e22eb344ec4beee258d1fb02e6fe8d744fd131 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Fri, 24 Jul 2026 20:14:09 +0530 Subject: [PATCH] fix: show real OAuth error on failure relay page When project is missing but an error query param is present, display the actual OAuth failure instead of the misleading "Missing redirect URL" message. --- .../(public)/auth/oauth2/failure/+page.svelte | 46 +++++++++++++++---- 1 file changed, 36 insertions(+), 10 deletions(-) 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}