Skip to content

Token cache ignores GOOGLE_WORKSPACE_CLI_CREDENTIALS_FILE when switching accounts #572

@nityeshaga

Description

@nityeshaga

Description

When switching between multiple Google accounts via GOOGLE_WORKSPACE_CLI_CREDENTIALS_FILE, the token cache at ~/.config/gws/token_cache.json continues serving the previously cached account's access token. The cache is not keyed by account or credential source.

Steps to reproduce

  1. gws auth login with account A
  2. gws auth export --unmasked 2>/dev/null > account-a.json
  3. gws auth login with account B
  4. gws auth export --unmasked 2>/dev/null > account-b.json
  5. rm ~/.config/gws/token_cache.json
  6. GOOGLE_WORKSPACE_CLI_CREDENTIALS_FILE=account-a.json gws gmail users getProfile --params '{"userId": "me"}' → returns account A ✓
  7. GOOGLE_WORKSPACE_CLI_CREDENTIALS_FILE=account-b.json gws gmail users getProfile --params '{"userId": "me"}'still returns account A
  8. rm ~/.config/gws/token_cache.json, then retry step 7 → returns account B ✓

Expected behavior

The token cache should be keyed by credential source (e.g., hash of the refresh token), so switching GOOGLE_WORKSPACE_CLI_CREDENTIALS_FILE between exported credential files works without manually deleting the cache.

Current workaround

Delete the token cache before switching accounts:

rm -f ~/.config/gws/token_cache.json

Environment

  • gws version: installed via Homebrew
  • OS: macOS (Apple Silicon, M1)
  • Auth method: exported credentials via gws auth export

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