From d5dd118a3f4ad6eed9ca496c458201bb10f148a0 Mon Sep 17 00:00:00 2001 From: Elias Schneider Date: Sun, 19 Jan 2025 15:39:55 +0100 Subject: [PATCH] feat: automatically authorize client if signed in --- frontend/src/routes/authorize/+page.svelte | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/frontend/src/routes/authorize/+page.svelte b/frontend/src/routes/authorize/+page.svelte index de50236..28d3fea 100644 --- a/frontend/src/routes/authorize/+page.svelte +++ b/frontend/src/routes/authorize/+page.svelte @@ -10,6 +10,7 @@ import { startAuthentication } from '@simplewebauthn/browser'; import { AxiosError } from 'axios'; import { LucideMail, LucideUser, LucideUsers } from 'lucide-svelte'; + import { onMount } from 'svelte'; import { slide } from 'svelte/transition'; import type { PageData } from './$types'; import ClientProviderImages from './components/client-provider-images.svelte'; @@ -26,6 +27,12 @@ export let data: PageData; let { scope, nonce, client, state, callbackURL, codeChallenge, codeChallengeMethod } = data; + onMount(() => { + if ($userStore) { + authorize(); + } + }); + async function authorize() { isLoading = true; try {