Desktop OIDC: full page nav to localhost, meta redirect back
Some checks failed
ci / build-test (push) Has been cancelled
ci / docker-build (push) Has been cancelled
Desktop App / Build Linux (amd64) (push) Has been cancelled
Desktop App / Attach to Release (push) Has been cancelled

SPA navigates to 127.0.0.1:18901/oidc/start, passing ret URL.
Go opens browser, waits for callback, saves token, returns HTML with
<meta refresh> back to Wails app with ?desktop=1&token=TOKEN.
main.ts extracts token from URL on reload.
This commit is contained in:
2026-07-14 00:13:01 +02:00
parent 8b3fe02a10
commit 2bd7de355b
5 changed files with 72 additions and 101 deletions

View File

@@ -103,7 +103,9 @@ export async function startLogin(): Promise<void> {
if (isDesktop) {
const apiUrl = getConfig().apiUrl || ''
throw new Error('DESKTOP_OIDC:' + apiUrl)
const ret = encodeURIComponent(location.origin + location.pathname.replace(/\/$/, '') + '?desktop=1')
location.href = `http://127.0.0.1:18901/oidc/start?apiUrl=${encodeURIComponent(apiUrl)}&ret=${ret}`
return
}
location.href = `${cfg.authorization_endpoint.replace(/\/$/, '')}/?${params}`