Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,15 @@
"overrides": {
"vite": "npm:rolldown-vite@latest",
"minimatch": "10.2.3",
"brace-expansion": ">=5.0.7",
"brace-expansion": ">=5.0.8",
"js-yaml": "^4.3.0",
"immutable": "^5.1.8",
"flatted": "^3.4.2",
"devalue": "^5.8.1",
"yaml": "^1.10.3",
"picomatch": "^4.0.4",
"cookie": "^0.7.0",
"ws": "^8.21.0"
"ws": "^8.21.0",
"postcss": "^8.5.18"
}
}
46 changes: 36 additions & 10 deletions src/routes/(public)/auth/oauth2/failure/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
Expand All @@ -27,15 +43,25 @@
{:catch}
<article class="card u-padding-16">
<div class="u-flex u-flex-vertical u-gap-16">
<Typography.Title>Missing redirect URL</Typography.Title>
<p class="text">
Your OAuth login flow is missing a proper redirect URL. Please check the
<a
class="link"
href="https://appwrite.io/docs/references/cloud/client-web/account#createOAuth2Session"
>OAuth docs</a>
and send request for new session with a valid callback URL.
</p>
{#if oauthError}
<Typography.Title>Login failed</Typography.Title>
<p class="text">
{oauthError.message ?? 'An error occurred during the OAuth login flow.'}
</p>
{#if oauthError.type}
<p class="text u-color-text-offline">Error type: {oauthError.type}</p>
{/if}
{:else}
<Typography.Title>Missing redirect URL</Typography.Title>
<p class="text">
Your OAuth login flow is missing a proper redirect URL. Please check the
<a
class="link"
href="https://appwrite.io/docs/references/cloud/client-web/account#createOAuth2Session"
>OAuth docs</a>
and send request for new session with a valid callback URL.
</p>
{/if}
</div>
</article>
{/await}
Expand Down