Skip to content

Bug: API calls return 401 after successful gws auth login --account — account-specific .enc credentials not discovered #452

@haydenmckay

Description

@haydenmckay

Environment

  • gws version: 0.4.4
  • OS: Linux (Arch Linux x64)
  • Installed via: npm @googleworkspace/cli

Steps to Reproduce

  1. Run gws auth login --account user@gmail.com
  2. Complete OAuth flow — success message confirms credentials saved to credentials.<base64-email>.enc
  3. Verify: gws auth list shows account as default
  4. Run any API call: gws gmail users messages list --params '{"userId": "me"}'

Expected

API call succeeds.

Actual

{"error": {"code": 401, "message": "Access denied. No credentials provided."}}

Root Cause

gws auth login --account saves tokens to credentials.<base64-email>.enc but gws auth status and all API calls look for credentials.enc (generic path). The account-specific file is never discovered.

gws auth status shows:

  • encrypted_credentials: credentials.enc (generic)
  • encrypted_credentials_exists: false
  • token_valid: false

...even though credentials.<base64-email>.enc exists with 334 bytes of content.

Also: gws auth export --account user@gmail.com returns 'No encrypted credentials found' despite the file existing.

Setting GOOGLE_WORKSPACE_CLI_ACCOUNT env var or pointing GOOGLE_WORKSPACE_CLI_CREDENTIALS_FILE directly at the .enc file both fail to resolve the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions