Skip to content

Commit 7adffb1

Browse files
author
Scott Strickland
committed
Adjust ID token handling for proxy mode
In proxy mode, the `id_token` from the upstream identity provider is now mapped to `access_token` in the response. This ensures that the token is verifiable, whereas the upstream access token might be from a different issuer. Without this fix, authentication to MCP-Trino appears to work, but upon making any requests, there are token verification failures.
1 parent 14f9009 commit 7adffb1

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

handlers.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,14 @@ func (h *OAuth2Handler) HandleToken(w http.ResponseWriter, r *http.Request) {
586586

587587
// Add ID token if present
588588
if idToken, ok := token.Extra("id_token").(string); ok {
589-
response["id_token"] = idToken
589+
if h.config.Mode == "proxy" {
590+
// In proxy mode, trino-mcp is going to expect to receive id tokens
591+
// that can be validated, not access tokens which can be opaque or
592+
// from another issuer (e.g. Microsoft Graph when using Azure).
593+
response["access_token"] = idToken
594+
} else {
595+
response["id_token"] = idToken
596+
}
590597
}
591598

592599
// Add scope if present

0 commit comments

Comments
 (0)