feat(whoami): consume account.me to populate user identity#101
Open
crowlbot wants to merge 1 commit into
Open
Conversation
The deployng `account.me` tRPC procedure has landed, so `deno deploy
whoami` can now identify the principal behind the token rather than
just listing reachable orgs.
- Calls `account.me` in parallel with `orgs.list` (no extra round
trip).
- JSON output: `user` field is now populated for user-backed tokens
(`{ id, name, email, avatarUrl, githubLogin }`) and `null` for
org-scoped (`ddo_`) tokens. A new `tokenType` field carries the
raw token type from the backend in both cases.
- Human output: the "Authenticated" line now names the principal
(`@github-login`, falling back to email/name/id, or
`org-scoped token (...)` for non-user tokens).
Existing agent consumers reading `authenticated` and `orgs[]` keep
working; only added fields.
Contributor
Author
|
The remaining
Safe to admin-merge alongside #100, or happy to re-run again if you'd like to wait for a green run. |
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.
Summary
Now that the deployng
account.metRPC procedure has landed,deno deploy whoamican identify the principal behind the active token, not just list reachable orgs.account.mein parallel withorgs.list(no extra round trip).userfield is now populated for user-backed tokens ({ id, name, email, avatarUrl, githubLogin }) and staysnullfor org-scoped (ddo_) tokens. A newtokenTypefield carries the raw token-type string from the backend in both cases.@github-loginif present, else email / name / id, ororg-scoped token (...)for non-user tokens.Compatibility
Additive only. Existing agent consumers reading
authenticatedandorgs[]keep working.Test plan
deno fmt/deno lint/deno check main.ts(CI).deno test -A(CI). Existingwhoami --jsontest intests/agent.test.ts:122still applies — it sends a bogus token to a closed-port endpoint and expects anAUTH_INVALID_TOKENenvelope.Promise.allrejects on the first failure, so the auth error still surfaces the same way.