Delegated sessions: act as the signed-in user via refresh-token BYOK#1
Merged
Conversation
…n user) Second BYOK shape: x-ms-tenant-id + x-ms-client-id + x-ms-refresh-token (or MS_REFRESH_TOKEN for stdio) redeems a delegated Graph token — the user's own Planner permissions apply and writes are attributed to them, which app-only client-credentials can never do. Entra-rotated refresh tokens are adopted for the session's lifetime. When both a secret and a refresh token arrive the refresh token wins: header-overlay proxies (the MCP gateway's per-user sessions) can add headers but not remove the shared spec's placeholders. scripts/device-login.mjs is the one-time sign-in helper that prints the refresh token to register. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Delegated sessions via refresh-token BYOK — act as the signed-in user. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
What
App-only (client-credentials) sessions act as the app registration — writes are attributed to the app and its application permissions apply tenant-wide. This adds a delegated BYOK shape so a session acts as a real user:
x-ms-tenant-id+x-ms-client-id+x-ms-refresh-token(public client, refresh-token grant)MS_REFRESH_TOKENinstead ofMS_CLIENT_SECRETscripts/device-login.mjs— zero-dependency device-code helper; prints the refresh token to keep (valid ~90 days past last use)Design notes
sessionMode: per-user) can add headers but cannot remove the shared spec's placeholder secret.Gateway pairing (NDR)
Users register the refresh token at the gateway's
/meas a personal credential (fieldx-ms-refresh-token, plusx-ms-client-idof the public client) — per-user sessions layer them as headers; Planner writes then attribute to the actual person.Tests
33 passing (12 new): config combinations (secret XOR refresh token), resolveAuth shapes + precedence + distinct key hashes, GraphClient delegated grant + access-token caching + rotated-token adoption, app-only regression.
🤖 Generated with Claude Code