warn: oauth2 without --app saves token to credential-less app#74
Merged
tcaldwell-x merged 1 commit intoMay 14, 2026
Merged
Conversation
When a user registers an app with client credentials and runs 'xurl auth oauth2' without --app, the token lands in the built-in 'default' profile which has no stored client_id/client_secret. Every subsequent API call fails with a cryptic 401 Unauthorized, and nothing in the error message points to the missing --app. Before running the OAuth2 flow, check whether the target app has stored client credentials. If the default app doesn't but another registered app does, print a warning to stderr with the exact fix. The OAuth flow still runs — users intentionally using the default app with env-var or manual credentials are not blocked.
tcaldwell-x
approved these changes
May 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a user registers an app with client credentials:
And then runs the OAuth2 flow without
--app:xurl auth oauth2 # missing --app my-appThe browser opens, the user authorizes, and the CLI prints:
But the token lands in the built-in
defaultprofile — which has no client credentials. Every subsequent API call fails with a cryptic401 Unauthorized, and nothing in the error message points to the missing--appas the root cause.This is the # 1 user footgun reported by downstream consumers (Hermes Agent, OpenClaw, direct CLI users).
Fix
Before running the OAuth2 flow, check whether the target app (default, when
--appis omitted) has stored client credentials. If it doesn't, but another registered app does, print a warning to stderr:Test plan
xurl auth apps add my-app --client-id X --client-secret Yxurl auth oauth2without--app→ warning appearsxurl auth oauth2 --app my-app→ no warning (correct usage)xurl auth oauth2→ no warning (nothing to suggest)