PC native — connection lost, retrying:
_send_keycloak_auth's DISCONNECTED handler was clearing _pending_keycloak_token
(taken at top of function) without restoring it, so the next _on_network_connected
had no token to retry with. Restore it: _pending_keycloak_token = token.
Web export — could not bind a local redirect port:
Godot's HTML5 export cannot create TCP server sockets. Add a separate web
code path in Keycloak.gd:
- start_auth_flow() detects OS.get_name() == "Web" and navigates the page
to Keycloak, persisting PKCE state (verifier, state, redirect_uri) in
sessionStorage before the page leaves.
- _check_web_callback() (called in _ready()) detects the ?code= params on
return, recovers state from sessionStorage, cleans the URL via
history.replaceState, then calls _exchange_code().
- auth_in_progress flag lets login_screen show "Completing sign-in..."
while the token exchange is in flight after page reload.
Requires the web game's origin to be registered as a valid redirect URI
in the Keycloak sor-game client.
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>