This document is scoped to the OAuth-gated /web-remote page only.
The QR route /remote is not OAuth-gated: it uses external relay
parameters sid/hash/t/mid/name/app_version and must not pass relay auth
material through OAuth state or safe-return helpers.
Historical remoteControlToken / relayOrigin notes below only describe old
/web-remote compatibility behavior and do not apply to /remote.
/web-remote/callback renders the OAuth callback page and delegates callback handling to WebAuthService.state = base64url(JSON.stringify({ nonce, app_return_to, return_to? })).remoteControlToken continue the existing relay bootstrap path.remoteControlToken render the logged-in waiting page until the device-list backend is available./ws and /ws/remote/:id bootstrap behavior.The web runtime stores the same core keys as desktop Z.AI login:
zcodejwttokenoauth:zai:access_tokenoauth:zai:user_infooauth:active_providerBrowserOAuthCredentialRepo is the only browser storage boundary for this flow. It restores a cached session only when all required keys are present and valid; partial Z.AI state is cleared and treated as logged out.
Local development may set:
VITE_DEV_ORIGIN=http://192.168.x.x:5173
This only writes return_to into OAuth state. A deployed callback page will forward to that private-origin callback only when its own build explicitly enables:
VITE_WEB_REMOTE_ALLOW_DEV_RETURN_TO=true
The Vite dev server proxies /api/v1/oauth/token to https://zcode.z.ai before the generic /api proxy so local token exchange does not accidentally hit the local server.