Root cause: GitLink login API returns session cookies (autologin_trustie),
not API access_tokens. The old code tried to use the cookie value as an
access_token query parameter, which GitLink rejects.
Fix: store auth cookies with "cookie:" prefix. Transport detects the
prefix and sends credentials as Cookie header instead of access_token
param. Private tokens (from --token mode) continue to use access_token
param — fully backward compatible.
Verified: login → store cookie → GetCurrentUser → repo list all pass.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
GetCurrentUser() was not checking the HTTP status code or the JSON
"status" field. GitLink returns {"status":401,"message":"无效token"}
as valid JSON, so json.Unmarshal succeeds and the function returns nil
error — making any token appear valid.
Now properly checks HTTP status code, JSON status field, and requires
"login" field in response. If login API tokens fail verification,
shows clear guidance to use private token (--token mode).
Root cause of Windows 401: login API returns session/CSRF token, not
a valid API access_token. The broken verification masked this entirely.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Prefer autologin cookie over response body token (body token may be CSRF/session token)
- Use cookiejar to capture cookies across redirects
- Try all candidate tokens and verify each with /users/me API call
- Detect keyring store/load mismatch and auto-fallback to file storage
- Login now fails fast if no candidate token works, instead of silently storing a bad token
Fixes Windows 401 "无效token" after successful login. Also improves
reliability on headless Linux (no Secret Service) and edge cases on macOS.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add windows/amd64 and windows/arm64 to build targets with .zip packaging
- Update npm install.js: win32 platform detection, .exe binary, PowerShell zip extraction
- Update npm cli.js wrapper to append .exe on Windows
- Fix credential path to use filepath.Join for cross-platform compatibility
- Update README with Windows support docs and FAQ
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>