-
Notifications
You must be signed in to change notification settings - Fork 504
Open
Description
name: 🐛 Bug Report
about: Create a report to help us improve
title: "[Bug] gws auth login fails on macOS - Keychain integration not working, credentials not saved"
labels: bug
Bug Description
On macOS, gws auth login completes the OAuth flow successfully, but credentials are not properly saved or recognized. Subsequent commands fail with "Access denied. No credentials provided."
Environment
- OS: macOS (Darwin 25.3.0, arm64)
- gws version: 0.4.4
- Installation: Homebrew (
npm install -g @googleworkspace/cli) - Node version: v25.6.1
Steps to Reproduce
- Run
gws auth login - Complete OAuth authentication in browser
- See "Authentication successful. Encrypted credentials saved." message
- Run any gws command (e.g.,
gws drive files list) - Get error: "Access denied. No credentials provided"
Expected Behavior
After successful authentication, credentials should be saved and subsequent commands should work without re-authentication.
Actual Behavior
$ gws auth login
Open this URL in your browser to authenticate:
https://accounts.google.com/o/oauth2/auth?...
# Complete authentication in browser
{
"account": "(unknown)",
"credentials_file": "/Users/yangtian/.config/gws/credentials.enc",
"encryption": "AES-256-GCM (key secured by OS Keyring or local `.encryption_key`)",
"message": "Authentication successful. Encrypted credentials saved.",
"status": "success"
}
$ gws drive files list --params '{"pageSize": 3}'
{
"error": {
"code": 401,
"message": "Access denied. No credentials provided. Run `gws auth login`...",
"reason": "authError"
}
}
$ gws auth list
{
"accounts": [],
"count": 0,
"default": ""
}Additional Context
Files Created
~/.config/gws/
├── .encryption_key # ✅ Created
├── credentials.enc # ✅ Created (encrypted)
└── client_secret.json # ✅ Exists
Keychain Status
# No gws-cli entry in macOS Keychain
$ security find-generic-password -s "gws-cli" -a "google-oauth" -w
security: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.Workaround
Python-based authentication works correctly:
- Using
google-authlibrary directly - Token saved to
~/.gws/token.json - Commands work when using Python scripts
Hypothesis
The issue appears to be with macOS Keychain integration:
- gws CLI attempts to store encryption key in Keychain
- Keychain entry is not created (no error shown)
- Encrypted credentials cannot be decrypted without the key
- Authentication appears successful but is unusable
Possible Solutions
- Fix macOS Keychain integration
- Provide fallback to unencrypted credentials file
- Add debug output for Keychain operations
- Document workaround for macOS users
Impact
- Severity: High - CLI is unusable on macOS after authentication
- Workaround: Use Python scripts or MCP integration instead
- Users Affected: All macOS users without Keychain integration
Related
- Similar issues with Keychain integration in other Node.js CLI tools
- May be related to macOS permissions or entitlements
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels