OIDC: local HTTP server instead of Wails bindings
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

The Wails runtime isn't reliably loading for IPC calls. Replace the
binding-based StartOIDCLogin with a local HTTP server on 127.0.0.1:18901:

- /oidc/login?apiUrl=... — opens system browser, waits for token
- /oidc/callback — Authentik redirect target, exchanges code
- /oidc/config?apiUrl=... — fetches OIDC provider config
- SPA detects desktop via ?desktop=1 URL param
- SPA calls localhost directly via fetch() instead of Wails IPC
This commit is contained in:
2026-07-13 23:52:08 +02:00
parent ff6608f9ea
commit 5664a4bf29
2 changed files with 205 additions and 133 deletions

View File

@@ -68,21 +68,25 @@
oidcLoggingIn = true
setConfig({ apiUrl: apiUrl.trim(), token: '' })
const wails = (window as any).wails
if (wails?.Call?.ByName) {
const isDesktop = new URLSearchParams(location.search).has('desktop')
if (isDesktop) {
try {
const token = await wails.Call.ByName('StartOIDCLogin', apiUrl.trim())
if (token) {
setConfig({ apiUrl: apiUrl.trim(), token })
initConfig({ apiUrl: apiUrl.trim(), token })
const resp = await fetch(`http://127.0.0.1:18901/oidc/login?apiUrl=${encodeURIComponent(apiUrl.trim())}`)
const data = await resp.json()
if (data.token) {
setConfig({ apiUrl: apiUrl.trim(), token: data.token })
initConfig({ apiUrl: apiUrl.trim(), token: data.token })
oidcLoggingIn = false
onConnected()
return
}
error = data.error || 'Login failed'
} catch (e: any) {
error = e?.message || e || 'OIDC login failed'
oidcLoggingIn = false
return
error = e.message || 'Could not reach OIDC service'
}
oidcLoggingIn = false
return
}
try {