Skip to content

Show the signed-in user in whoami from /v1/me - #189

Merged
Gorka Gonzalo (d0ubl3g) merged 1 commit into
devfrom
feat/whoami-user
Oct 15, 2026
Merged

Gorka Gonzalo (d0ubl3g) merged 1 commit into
devfrom
feat/whoami-user

Conversation

@d0ubl3g

Copy link
Copy Markdown
Contributor

whoami reads the signed-in user from data.user of GET /v1/me, taken from the body as received because the vendored API document (2026-10-19) does not describe the field yet. A missing field, null or a malformed value is no user and never an error.

  • User line and --json user keep their name and type (a string): Name <email>, from the API first, then the userinfo endpoint as the fallback, as before.
  • Only for a sign-in; for an API key or a portfolio key any user in the answer is ignored.
  • API strings are cleaned before printing.
  • No extra HTTP call.

This waits for the API to return user in GET /v1/me for sign-ins. It is safe to merge before: until then the output is unchanged.

Tests: unit tests with a user (including an escape sequence), no field, null, malformed values, the userinfo fallback and a key; a contract test that a key ignores a user in the answer.

Closes #182

whoami now reads the user of a sign-in from the body of GET /v1/me as
received (data.user), not from the generated type, because the vendored
API document does not describe the field yet. It is read leniently: a
missing field, null or a malformed value is no user, never an error.

The User line and the --json user string keep their name and type. They
are filled from the API first, formatted as Name <email>, and the
authorization server's userinfo endpoint is only asked when the API
gives no user. For a key the field is ignored. Every string is cleaned
before it is printed.

No extra request is made, and nothing changes in the output until the
API returns the field.

Closes #182

Signed-off-by: d0ubl3g <48954024+d0ubl3g@users.noreply.github.com>
@d0ubl3g
Gorka Gonzalo (d0ubl3g) marked this pull request as ready for review October 15, 2026 17:05
@d0ubl3g
Gorka Gonzalo (d0ubl3g) merged commit 7bc2d7f into dev Oct 15, 2026
20 checks passed
@d0ubl3g
Gorka Gonzalo (d0ubl3g) deleted the feat/whoami-user branch October 15, 2026 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant