diff --git a/src/lib/utilities/route-for.ts b/src/lib/utilities/route-for.ts index fe50b5bf5..817b030e4 100644 --- a/src/lib/utilities/route-for.ts +++ b/src/lib/utilities/route-for.ts @@ -1,5 +1,5 @@ import { BROWSER } from 'esm-env'; -import { InvalidTokenError, jwtDecode, JwtPayload } from 'jwt-decode'; +import { InvalidTokenError, jwtDecode, type JwtPayload } from 'jwt-decode'; import { base } from '$app/paths'; @@ -301,7 +301,9 @@ export const routeForOIDCImplicitCallback = (): string => { } const state = hash.get('state'); - const redirectUrl = new URL(sessionStorage.getItem(state) ?? '/'); + const redirectUrl = new URL( + (state ? sessionStorage.getItem(state) : null) ?? '/', + ); sessionStorage.removeItem('state'); setAuthUser(