From 671c9cd8d2fa38d69b976c5b1086617ee0c68f5d Mon Sep 17 00:00:00 2001 From: kubo997 Date: Fri, 21 Nov 2025 00:42:35 +0100 Subject: [PATCH 1/2] fix issue #418: steam 403 error when running locally --- src/runtime/server/lib/oauth/steam.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/runtime/server/lib/oauth/steam.ts b/src/runtime/server/lib/oauth/steam.ts index a0e73870..854c155b 100644 --- a/src/runtime/server/lib/oauth/steam.ts +++ b/src/runtime/server/lib/oauth/steam.ts @@ -39,14 +39,15 @@ export function defineOAuthSteamEventHandler({ config, onSuccess, onError }: OAu } const url = getRequestURL(event) - + const dev = import.meta.dev; if (!query['openid.claimed_id']) { const redirectURL = config.redirectURL || getRequestURL(event).href + const realm = dev && url.hostname === 'localhost' ? `${url.protocol}//${url.hostname}:${url.port}` : `${url.protocol}//${url.hostname}` const steamOpenIdParams = { 'openid.ns': 'http://specs.openid.net/auth/2.0', 'openid.mode': 'checkid_setup', 'openid.return_to': redirectURL, - 'openid.realm': `${url.protocol}//${url.hostname}`, + 'openid.realm': realm, 'openid.identity': 'http://specs.openid.net/auth/2.0/identifier_select', 'openid.claimed_id': 'http://specs.openid.net/auth/2.0/identifier_select', } From 640d864ef0338a4b3ab33e21cc6aeb09919e03af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Tue, 9 Dec 2025 15:42:54 +0100 Subject: [PATCH 2/2] simplify --- src/runtime/server/lib/oauth/steam.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/runtime/server/lib/oauth/steam.ts b/src/runtime/server/lib/oauth/steam.ts index 854c155b..e93f9d23 100644 --- a/src/runtime/server/lib/oauth/steam.ts +++ b/src/runtime/server/lib/oauth/steam.ts @@ -39,10 +39,9 @@ export function defineOAuthSteamEventHandler({ config, onSuccess, onError }: OAu } const url = getRequestURL(event) - const dev = import.meta.dev; if (!query['openid.claimed_id']) { const redirectURL = config.redirectURL || getRequestURL(event).href - const realm = dev && url.hostname === 'localhost' ? `${url.protocol}//${url.hostname}:${url.port}` : `${url.protocol}//${url.hostname}` + const realm = url.port ? `${url.protocol}//${url.hostname}:${url.port}` : `${url.protocol}//${url.hostname}` const steamOpenIdParams = { 'openid.ns': 'http://specs.openid.net/auth/2.0', 'openid.mode': 'checkid_setup',