Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

RFC: Agent auth flow feedback: interactive vs headless login paths #245

jpoehnelt-bot started this conversation in Ideas
Discussion options

Hi folks — sharing concrete feedback after trying to run real integration tests with gws from an agent environment.

What worked well

  • Install and discovery are clear (gws --help)
  • gws auth status is very useful (project, config paths, credential presence)
  • gws auth setup gives actionable project/client setup guidance
  • API errors were generally useful (401 no credentials, 403 insufficient scopes)

What was confusing for agent/headless usage

  1. No creds present → Sheets call failed with 401 (expected)
  2. Tried GOOGLE_WORKSPACE_CLI_TOKEN from gcloud auth print-access-token → call reached API but failed with 403 insufficient authentication scopes
  3. gws auth login uses browser + localhost callback, which is awkward in headless/agent sessions

Suggestions

  1. Add docs section: "Interactive developer login vs agent login" with a decision tree
  2. Add gws auth login --device (device code flow) for headless use
  3. Add gws auth doctor to validate:
    • credentials present
    • token scopes match requested service
    • required APIs enabled
    • exact remediation commands
  4. Improve 403 insufficient scopes hints to include likely missing scopes based on command context
  5. Add an "agent bootstrap" snippet (env vars + minimal scopes + smoke test)

Key elements extracted from related work

Path selection (interactive vs headless)

Scope selection UX

Active bug still open

Happy to test a revised flow again and report back with a full end-to-end Sheets integration run (create/write/batchUpdate/readback).

You must be logged in to vote

Replies: 5 comments 1 reply

Comment options

Plan A — Minimal patch (fastest)

Goal: remove major headless friction with the smallest change set.

Pros: quickest to stabilize, low regression risk.
Cons: no full device-code flow; users still paste codes in some setups.

You must be logged in to vote
0 replies
Comment options

Plan B — Headless-first auth matrix

Goal: make auth path selection explicit and predictable across local/devbox/container/CI environments.

  • Introduce explicit mode flags (default localhost, no-localhost interactive, optional fixed-port mode)
  • Print runtime decision text (e.g., "Selected auth mode: ... because ...")
  • Add gws auth doctor preflight for credentials, scopes, and API enablement
  • Ensure every service alias maps to at least one OAuth scope (covers gws auth login -s chat does not request Chat API OAuth scope #236 -class bugs)

Pros: clearest UX for agents and remote users.
Cons: larger implementation and test surface.

You must be logged in to vote
0 replies
Comment options

Plan C — Scope UX hardening + incremental consent

Goal: improve the scope-selection journey and reduce re-login loops.

Pros: strongest scope ergonomics and least-privilege workflow.
Cons: does not fully solve headless path selection by itself.

You must be logged in to vote
0 replies
Comment options

Plan D — Unified auth overhaul (comprehensive)

Goal: provide one cohesive auth system for both developers and agents.

  • Implement full auth mode set (localhost, no-localhost interactive, optional device-code if feasible)
  • Keep service-first scope picker and add incremental scope upgrades
  • Add gws auth doctor plus richer 401/403 diagnostics with scope hints
  • Publish an "Agent setup" quickstart with non-interactive-friendly examples

Pros: most complete long-term solution for mixed human + agent use.
Cons: largest scope; needs phased rollout and careful QA.

You must be logged in to vote
0 replies
Comment options

How soon the team will add this support of headless login for gws CLI ? This feature is needed in-order for containeried/sandboxed agent to use the gws CLI

You must be logged in to vote
1 reply
Comment options

We have the exact same use case, an ETA would be very appreciated. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /