From 741286f773f6ca99f42e01d6b9b80d23ff128dfb Mon Sep 17 00:00:00 2001 From: Vargha Csongor Date: Tue, 14 May 2024 23:29:58 +0200 Subject: [PATCH] fix redirect url --- frontend/src/lib/auth.ts | 9 ++++++--- frontend/src/routes/+page.svelte | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/frontend/src/lib/auth.ts b/frontend/src/lib/auth.ts index d671ccf..579418b 100644 --- a/frontend/src/lib/auth.ts +++ b/frontend/src/lib/auth.ts @@ -6,16 +6,19 @@ import { browser } from '$app/environment'; let userManager: UserManager; if (browser) { + const host_url = window.location.href.startsWith('http://') + ? 'http://' + : 'https://' + window.location.hostname; const config = { authority: PUBLIC_ISSUER, // At Zitadel Project Console > [Your project] > [Your application] > URLs - Issuer client_id: PUBLIC_ZITADEL_CLIENT_ID, // At Zitadel Project Console > [Your project] > [Your application] > Configuration - Client ID - redirect_uri: window.location.hostname + '/callback', // At Zitadel Project Console > [Your project] > [Your application] > URLs - Login Redirect URI + redirect_uri: host_url + '/callback', // At Zitadel Project Console > [Your project] > [Your application] > URLs - Login Redirect URI response_type: 'code', scope: 'openid profile email', - post_logout_redirect_uri: window.location.hostname, + post_logout_redirect_uri: host_url, userStore: new WebStorageStateStore({ store: window.localStorage }), automaticSilentRenew: true, - silent_redirect_uri: window.location.hostname + '/silent-refresh' + silent_redirect_uri: host_url + '/silent-refresh' }; userManager = new UserManager(config); diff --git a/frontend/src/routes/+page.svelte b/frontend/src/routes/+page.svelte index 5b49065..3893d1a 100644 --- a/frontend/src/routes/+page.svelte +++ b/frontend/src/routes/+page.svelte @@ -14,8 +14,8 @@ import AddFamilyMember from '$lib/family_tree/AddFamilyMember.svelte'; import CreateProfile from '$lib/family_tree/CreateProfile.svelte'; - let relationshipPanel: string; - let AddFamilyMemberPanel: string; + let relationshipPanel = ''; + let AddFamilyMemberPanel = ''; let CreateProfilePanel = false; const nodes = writable([]);