Description
csglite has been configured with an API Key, but when the JWT token expires, the tool does not fall back to the configured API Key for authentication. Instead, it directly throws a 401 error and prompts the user to log in again.
Reproduction Steps
Log in to csglite via /login to obtain a JWT token (works normally).
Configure an API Key (confirm it is written into the config and usable).
Wait for the JWT token to expire (or manually invalidate it).
Run any csglite command again.
Actual Behavior
After the JWT expires, even with an API Key configured, the following error is thrown:
Please run /login · API Error: 401 OpenCSG login expired or token is invalid. Please log in again.
The tool does not fall back to API Key authentication and forces the user to log in again.
Expected Behavior
When the JWT token expires or becomes invalid, csglite should automatically fall back to the configured API Key for authentication instead of forcing a re-login. The authentication priority should be:
- Prefer JWT token (while valid)
- Fall back to API Key when JWT is expired/invalid
- Only prompt login when neither is available
Impact
Users with an API Key configured are blocked after JWT expiry — poor UX.
Long-lived API Key use cases (e.g., CI/CD, automation scripts) are interrupted.
Environment
- Tool: csglite
- Error code: 401
- Error message: OpenCSG login expired or token is invalid. Please log in again.
Description
csglite has been configured with an API Key, but when the JWT token expires, the tool does not fall back to the configured API Key for authentication. Instead, it directly throws a 401 error and prompts the user to log in again.
Reproduction Steps
Log in to csglite via /login to obtain a JWT token (works normally).
Configure an API Key (confirm it is written into the config and usable).
Wait for the JWT token to expire (or manually invalidate it).
Run any csglite command again.
Actual Behavior
After the JWT expires, even with an API Key configured, the following error is thrown:
Please run /login · API Error: 401 OpenCSG login expired or token is invalid. Please log in again.The tool does not fall back to API Key authentication and forces the user to log in again.
Expected Behavior
When the JWT token expires or becomes invalid, csglite should automatically fall back to the configured API Key for authentication instead of forcing a re-login. The authentication priority should be:
Impact
Environment