Fix /token (GET) response field: tokenType → token_type (fixes newer Azure SDK clients) - #125
Merged
Gérald Barré (geraldbarre-workleap) merged 1 commit intoSep 23, 2026
Conversation
Martijn Wennink (JoeBengalen)
requested a review
from a team
as a code owner
September 23, 2026 08:54
Copilot started reviewing on behalf of
Gérald Barré (geraldbarre-workleap)
September 23, 2026 15:59
View session
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused change has no unresolved blocking issues.
Review effort: Lite
Findings: None
What changed in this PR
Updates the GET /token response to use the Azure SDK-compatible token_type field.
Changes:
- Renames
tokenTypetotoken_type. - Preserves existing token metadata and serialization.
| File | Summary |
|---|---|
Program.cs |
Corrects the GET token response field name. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Gérald Barré (geraldbarre-workleap)
approved these changes
Sep 23, 2026
Gérald Barré (geraldbarre-workleap)
merged commit Sep 23, 2026
2bbe1db
into
workleap:main
2 of 3 checks passed
Contributor
Author
|
New image works for me. Thank you for the fast merge and release :) |
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
The
GET /tokenendpoint (the one consumed viaIDENTITY_ENDPOINT+IMDS_ENDPOINT, emulating the Azure Arc managed-identity source) returns the token-type field as:This field name doesn't match what recent versions of the Azure SDK for .NET actually parse. As a result, any consumer using a moderately recent
Azure.Identity/Azure.Coreversion gets a silently malformedAuthorizationheader — missing theBearerscheme prefix entirely — and every downstream request fails with a 401/RequestFailedException.The
POST /tokenendpoint already uses the correct field name (token_type) — only theGETendpoint has the bug.Why this breaks
Microsoft.Identity.Client(MSAL), which recentAzure.Identity/Azure.Coreversions use internally to handle managed-identity token acquisition (including the Arc flow this proxy emulates), deserializes the token type from a JSON property explicitly namedtoken_type:Since the proxy sends
tokenType(camelCase) instead, this property is never populated and defaults tonull/empty.Starting in
Azure.Core 1.59.0,BearerTokenAuthenticationPolicystopped hardcoding theAuthorizationheader scheme as"Bearer "and instead builds it from the token's actual type:(This change shipped alongside experimental mTLS Proof-of-Possession support, where the token type is no longer always
"Bearer".)Combined with the empty
TokenTypeabove, the resulting header becomes a single leading space followed by the raw token — noBearerscheme at all — which every Azure resource correctly rejects with a 401.Older SDK versions never hit this because managed-identity token acquisition was implemented by hand in
Azure.Identityand always force-setTokenType = "Bearer"regardless of what the JSON response said, masking the field-name mismatch for years.Minimal reproduction
Run this against the container as currently published: the printed header is
[ eyJ...](leading space, no scheme) and the call fails with a 401. With the field name corrected and the image rebuilt, the header becomes[Bearer eyJ...]and the call succeeds.I verified this locally end-to-end: same package versions, same real Azure AD credentials via
az, the only variable changed was this field name — unpatched image fails every request, patched image succeeds.