Desktop OIDC: open in system browser via window.open, revert to copy-paste
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 local HTTP server approach (fetch to 127.0.0.1) doesn't work in the
Wails webview. Simplify: use window.open() to launch OIDC in the real
browser. After authentication, the callback page at the server shows the
token. User copies and pastes into the Token tab.

Also fix: SetSize before app.Run() crashes with nil pointer — use
WebviewWindowOptions width/height directly from restored state.
This commit is contained in:
2026-07-14 00:00:24 +02:00
parent 68011f9a06
commit 56e509d506
3 changed files with 15 additions and 26 deletions

View File

@@ -67,27 +67,7 @@
error = ''
oidcLoggingIn = true
setConfig({ apiUrl: apiUrl.trim(), token: '' })
const isDesktop = new URLSearchParams(location.search).has('desktop')
if (isDesktop) {
try {
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 || 'Could not reach OIDC service'
}
oidcLoggingIn = false
return
}
initConfig({ apiUrl: apiUrl.trim(), token: '' })
try {
await startLogin()