-
Notifications
You must be signed in to change notification settings - Fork 292
Open
Description
Description
After a successful gws auth login, all API calls fail with:
{
"error": {
"code": 401,
"message": "Gmail auth failed: Failed to parse authorized user credentials",
"reason": "authError"
}
}
Environment
- gws version: 0.4.3
- OS: macOS (Darwin 25.3.0)
- Encryption: AES-256-GCM with local .encryption_key
Steps to Reproduce
- gws auth setup → success
- gws auth login → completes OAuth flow, saves credentials.enc
- gws auth status → shows token_valid: true, correct scopes, encryption_valid: true
- gws gmail +triage → fails with 401
- gws gmail users messages list --params '{"userId": "me"}' → also fails with 401
Investigation
- gws auth export works and shows (masked) credentials — confirming the encrypted file can be decrypted.
- Manually decrypting credentials.enc using the .encryption_key with Node.js crypto.createDecipheriv('aes-256-gcm', ...) produces valid JSON with all fields (client_id, client_secret, refresh_token, type).
- Exchanging the decrypted refresh_token for an access token via curl to https://oauth2.googleapis.com/token succeeds.
- Using GOOGLE_WORKSPACE_CLI_TOKEN=<access_token> gws gmail +triage works correctly.
This confirms the credentials are valid but gws fails to parse them during API call authentication, despite successfully decrypting them during auth export and auth status.
Attempted Workarounds
- Deleted .encryption_key + credentials.enc and re-ran gws auth login → same error
- Exported credentials to a plain JSON file and set GOOGLE_WORKSPACE_CLI_CREDENTIALS_FILE → fails with Failed to get token
- Setting GOOGLE_WORKSPACE_CLI_TOKEN with a manually obtained access token → works (but tokens expire after 1 hour)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels