Skip to content

feat(auth): add named account profiles#788

Closed
rohan-patnaik wants to merge 1 commit into
googleworkspace:mainfrom
rohan-patnaik:feat/auth-profiles
Closed

feat(auth): add named account profiles#788
rohan-patnaik wants to merge 1 commit into
googleworkspace:mainfrom
rohan-patnaik:feat/auth-profiles

Conversation

@rohan-patnaik
Copy link
Copy Markdown

Description

Adds named auth profiles so users can keep separate Google Workspace credentials and token caches for different accounts or tenants.

What changes:

  • Adds a global --profile <name> flag and GOOGLE_WORKSPACE_CLI_PROFILE env var.
  • Keeps the existing default profile paths unchanged.
  • Stores named profile credentials and token caches under ~/.config/gws/profiles/<name>/.
  • Makes auth login, auth status, and auth logout profile-aware.
  • Clears profile token caches after auth login so a profile does not keep using stale tokens from a previous login.
  • Keeps OAuth client configuration shared, so users do not need to duplicate client_secret.json for every profile.

This is intended to make account switching explicit and safer for users who work across multiple accounts, Workspace domains, or customers.

Refs #439, #572, #764, #780.

Dry Run Output:

// Not applicable: this adds auth profile storage/routing, not a request-building helper.

Checklist:

  • My code follows the AGENTS.md guidelines (no generated google-* crates).
  • I have run cargo fmt --all to format the code perfectly.
  • I have run cargo clippy -- -D warnings and resolved all warnings. See testing note below.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have provided a Changeset file (e.g. via pnpx changeset) to document my changes.

Testing

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 10, 2026

🦋 Changeset detected

Latest commit: 46af288

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@googleworkspace/cli Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@googleworkspace-bot googleworkspace-bot added area: auth area: core Core CLI parsing, commands, error handling, utilities labels May 10, 2026
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the CLI by adding support for named authentication profiles. This enables users to manage multiple Google Workspace identities independently without needing to duplicate OAuth client configurations. The changes include new command-line flags, environment variable support, and updated file path logic to ensure credentials and caches are isolated per profile.

Highlights

  • Named Auth Profiles: Introduced support for named authentication profiles, allowing users to maintain separate Google Workspace credentials and token caches for different tenants or accounts.
  • Global Configuration: Added a global --profile <name> flag and GOOGLE_WORKSPACE_CLI_PROFILE environment variable to manage profile selection.
  • Isolated Storage: Configured profile-specific storage paths under ~/.config/gws/profiles/<name>/ while maintaining backward compatibility for the default profile.
  • Auth Lifecycle Integration: Updated auth login, auth status, and auth logout to be profile-aware, including automatic token cache clearing upon login to prevent stale token usage.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Generative AI Prohibited Use Policy, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces named auth profiles to the CLI, allowing users to maintain isolated credentials and token caches. Users can specify a profile using the --profile flag or the GOOGLE_WORKSPACE_CLI_PROFILE environment variable. The implementation includes logic for profile-specific directory resolution, profile name validation, and updated argument parsing to handle global flags. I have no feedback to provide as no review comments were submitted.

@github-actions
Copy link
Copy Markdown
Contributor

This PR has been inactive for 72 hours. Closing to keep the queue clean.

@github-actions github-actions Bot added the Stale label May 14, 2026
@github-actions
Copy link
Copy Markdown
Contributor

This PR was closed because it has been stalled for 72 hours. Feel free to magically reopen it if you want to continue working on it!

@github-actions github-actions Bot closed this May 14, 2026
@rohan-patnaik
Copy link
Copy Markdown
Author

This PR was auto-closed for inactivity. The branch is still available, checks were passing, and Gemini had no remaining feedback. Could a maintainer reopen this for review when convenient?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: auth area: core Core CLI parsing, commands, error handling, utilities Stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants