You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
auth login: requesting new scopes on an existing login silently succeeds; invalid-scope error doesn't name the scope #552
Version: 1.0.0-beta.28, Linux (headless server, OAuth device flow)
What happened
I needed to add one scope (billing.read) to an existing OAuth login that many scheduled jobs on a headless server depend on.
cf login --device --no-browser --scopes <current scopes> billing.read while already logged in prints:
● You are already logged in.
│ Run cf auth login --force to re-authenticate, or cf auth logout to log out.
and exits 0. The requested scopes are ignored, so a script can't tell that nothing changed.
Re-requesting the scopes the stored login already holds (read from the config file) plus the new one, with cf auth login --force --device --no-browser --scopes …, fails with:
One or more of the requested scopes are not valid cf OAuth scopes.
It doesn't say which ones. The stored grant includes scopes such as openid, offline, offline_access that apparently can't be requested, so the saved list can't be reused as-is.
Why it matters
On a headless box shared by many jobs, adding one permission currently means a full forced re-login with the default scopes and guessing what's requestable. The safest path isn't obvious (an auth --profile dedicated to the new scope, which I found later).
Suggestions
When --scopes asks for something the current login doesn't have, either re-authenticate or exit non-zero with a clear message, instead of exiting 0.
Name the invalid scopes in the error.
An --add-scopes (or cf auth scopes add) that requests the current grant plus the new scopes, skipping ones that aren't requestable.
In cf auth login --help, mention --profile as the way to hold a separate login for extra permissions without touching the default one.
Activity
fix(auth): name invalid OAuth scopes and require --force for new scop…
fix(auth): trigger new login flow when requesting new scopes (cloudfl…
fix(auth): name invalid OAuth scopes and re-authenticate when scopes …