Repository navigation
Add bl whoami to print your user ID - #50
Open
scottcrawford03 wants to merge 1 commit into
Open
scottcrawford03 wants to merge 1 commit into
scottcrawford03 wants to merge 1 commit into
Conversation
`bl auth status` shows the session and workspace but not the `user-*` ID
that Apps Platform uses for app owners and publishers, so finding your
own ID meant reading the `owner` of an app you already own.
`bl whoami` reads `caller` from the control plane's current-user
discovery (`GET /v1/apps/me?limit=1`) with the same control plane and
authentication as `bl apps`, including the Blox proxy. It prints the ID
alone, or `{"user_id", "environment"}` with --json, and fails with
`caller_missing` if the response has no caller.
Co-authored-by: octopus <822c70215c3e7c911200b21e6489f79227c744a53fd35fc71254c84229a8b7ca@buzz.block.builderlab.xyz>
jonwinton
approved these changes
Nov 16, 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.
Why
Apps Platform identifies people by a
user-*ID, which shows up as an app'sownerand in publisher lists. You also need it when someone adds you as a publisher.bl auth statusdoesn't show it, so today the only way to find your own ID is to read theownerof an app you already own.What
Add a top-level
bl whoamicommand:bl whoamiprints the ID by itself, for exampleuser-RC1BSbHMpBkDJm-o.bl whoami --jsonprints{"user_id": "...", "environment": "..."}.caller, it fails withcaller_missing.The README has a short "Your user ID" section.
How
It reads
callerfrom the control plane's current-user discovery (GET /v1/apps/me?limit=1). The control plane setscallerfrom the verified principal, never from request parameters. The command uses the samecontrol_plane_args, host allowlist, session or Blox proxy authentication and error mapping asbl apps.limit=1keeps the response small, since the command reads onlycaller.I chose this route over the owned listing (
/v1/agent/apps?scope=owned, which also returnscaller). The owned listing enumerates the fleet and took 2–3s in bb-block production, while/v1/apps/meanswered in about 0.5s once warm.Risk
Low. This adds a new read-only command and leaves existing commands alone. In forwarded-workspace mode,
/v1/apps/mereturns 503 when the control plane has no membership provider configured. The command would then show the standard Apps HTTP error. It works in bb-block production. I haven't checked bb-public.Testing
just checkpasses: fmt, clippy, and all lib and e2e tests.caller. The root--describe-commandstest now expectswhoami.compose-ctrl.block.builderlab.xyz). It printed the expecteduser-*ID, and--jsonreturnedenvironment: production.