feat: automatically authorize client if signed in

This commit is contained in:
Elias Schneider
2025-01-19 15:39:55 +01:00
parent 06b90eddd6
commit d5dd118a3f

View File

@@ -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 {