Google-Health-API / Google-Health-API/google-health-cli

--scopes-preset all produces a token that can't read any data (includes cloud-platform)

Open Beginner friendly
#3 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
253
Forks
27
PR merge metrics
No merged PRs in 30d

Description

Summary

Running auth login with the all preset produces credentials that can't query any health data. Every data command fails with 403 "Request contains disallowed OAuth scope(s)." The all preset includes the cloud-platform scope, and the data-plane endpoints reject any token that carries it.

Steps to reproduce

ghealth auth login --scopes-preset all
ghealth data steps daily-rollup --from 2026-06-25 --to 2026-07-02

Actual result

{
  "error": {
    "type": "api",
    "status": 403,
    "message": "Request contains disallowed OAuth scope(s).",
    "hint": "Check that the Health API is enabled and you have the required OAuth scopes"
  }
}

A tokeninfo call confirms cloud-platform is present alongside the googlehealth.* scopes.

Cause

ScopePreset("all") in pkg/auth/auth.go:199 returns every entry in AllScopes, and cloud-platform is one of them (pkg/auth/auth.go:66). So all means every scope, including the webhook-admin one, which breaks reads.

This incompatibility is already documented, but only in the webhooks command help and the source comment at cmd/webhooks.go:50 ("a token carrying cloud-platform is REJECTED by the data-plane endpoints"). Nothing near setup, auth login, or the preset docs mentions it, so picking all looks like the obvious choice and quietly breaks data reads.

What worked for me

Excluding cloud-platform from the all preset so it only covers data scopes. Webhook admin still works through a separate --scopes cloud-platform login, which is the pattern the docs already describe.

Version: ghealth 0.1.0 (dev)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in pkg/auth/auth.go at ScopePreset("all") around line 199 and review the cloud-platform entry in AllScopes around line 66. Check the existing guidance in cmd/webhooks.go:50 and the setup, auth login, and preset documentation. Done means the all preset no longer breaks data-plane reads, while cloud-platform remains available through an explicit separate scope selection.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
authentication, cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.