Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fix-tui-cloud-platform-scope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@googleworkspace/cli": patch
---

Stop TUI scope picker from unconditionally injecting cloud-platform scope
7 changes: 1 addition & 6 deletions crates/google-workspace-cli/src/auth_commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,7 @@ fn run_discovery_scope_picker(
relevant_scopes: &[crate::setup::DiscoveredScope],
services_filter: Option<&HashSet<String>>,
) -> Option<Vec<String>> {
use crate::setup::{ScopeClassification, PLATFORM_SCOPE};
use crate::setup::ScopeClassification;
use crate::setup_tui::{PickerResult, SelectItem};

let mut recommended_scopes = vec![];
Expand Down Expand Up @@ -1102,11 +1102,6 @@ fn run_discovery_scope_picker(
}
}

// Always include cloud-platform scope
if !selected.contains(&PLATFORM_SCOPE.to_string()) {
selected.push(PLATFORM_SCOPE.to_string());
}

// Hierarchical dedup: if we have both a broad scope (e.g. `.../auth/drive`)
// and a narrower scope (e.g. `.../auth/drive.metadata`, `.../auth/drive.readonly`),
// drop the narrower one since the broad scope subsumes it.
Expand Down
2 changes: 0 additions & 2 deletions crates/google-workspace-cli/src/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,6 @@ pub enum ScopeClassification {
Restricted,
}

pub const PLATFORM_SCOPE: &str = "https://www.googleapis.com/auth/cloud-platform";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The PLATFORM_SCOPE constant should be retained. Although its direct usage in the TUI injection logic was removed, the same string literal is still used in multiple other locations within the codebase (e.g., FULL_SCOPES and SCOPE_ENTRIES in auth_commands.rs). Hardcoding this URL in multiple places reduces maintainability and increases the risk of inconsistencies or typos. It is recommended to keep the constant and use it wherever the cloud-platform scope URL is required.


/// A scope discovered from a Discovery Document.
#[derive(Clone)]
pub struct DiscoveredScope {
Expand Down
Loading