forked from appwrite/console
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path+page.svelte
30 lines (25 loc) · 1.15 KB
/
+page.svelte
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<script lang="ts">
import { page } from '$app/stores';
import { Heading } from '$lib/components';
import { Account, Client } from '@appwrite.io/console';
import { onMount } from 'svelte';
import { VARS } from '$lib/system';
const client = new Client();
const account = new Account(client);
onMount(async () => {
const endpoint = VARS.APPWRITE_ENDPOINT ?? `${$page.url.origin}/v1`;
const projectId = $page.url.searchParams.get('project');
client.setEndpoint(endpoint).setProject(projectId);
const userId = $page.url.searchParams.get('userId');
const secret = $page.url.searchParams.get('secret');
await account.updateMagicURLSession(userId, secret);
window.location.href = `appwrite-callback-${projectId}://${$page.url.search}`;
});
</script>
<Heading tag="h1" size="1">Missing redirect URL</Heading>
<p>
Your Magic URL login flow is missing a proper redirect URL. Please check the
<a href="https://appwrite.io/docs/references/cloud/client-web/account#createMagicURLSession"
>Magic URL docs</a>
and send request for new session with a valid redirect URL.
</p>