Skip to content

Commit 67def73

Browse files
bhosmer-antclaude
andcommitted
Fix token audience validation in separate auth mode
The auth server's /introspect endpoint now correctly sets the 'aud' field to the resource server URL (BASE_URI) instead of the client ID. This ensures proper audience validation when the MCP server verifies tokens in separate mode. - Import BASE_URI in auth server - Set aud to BASE_URI in introspection response - Fixes "Token was not issued for this resource server" error 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent a735b98 commit 67def73

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

auth-server/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { EverythingAuthProvider } from '../src/auth/provider.js';
66
import { handleFakeAuthorize, handleFakeAuthorizeRedirect } from '../src/handlers/fakeauth.js';
77
import { redisClient } from '../src/redis.js';
88
import { logger } from '../src/utils/logger.js';
9-
import { AUTH_SERVER_PORT, AUTH_SERVER_URL } from '../src/config.js';
9+
import { AUTH_SERVER_PORT, AUTH_SERVER_URL, BASE_URI } from '../src/config.js';
1010

1111
const app = express();
1212

@@ -101,7 +101,7 @@ app.post('/introspect', introspectRateLimit, express.urlencoded({ extended: fals
101101
userId: authInfo.extra?.userId, // Custom field for our implementation
102102
username: authInfo.extra?.username,
103103
iss: AUTH_SERVER_URL,
104-
aud: authInfo.clientId,
104+
aud: BASE_URI, // The resource server URL this token is intended for
105105
token_type: 'Bearer'
106106
});
107107

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"dev:with-separate-auth": "concurrently -n \"AUTH,MCP\" -c \"yellow,cyan\" \"npm run dev:auth-server\" \"npm run dev:separate\"",
1616
"build": "tsc && npm run copy-static",
1717
"copy-static": "mkdir -p dist/src/static && cp -r src/static/* dist/src/static/",
18-
"lint": "eslint src/ auth-server/",
18+
"lint": "eslint src/ auth-server/ shared/",
1919
"test": "NODE_OPTIONS=--experimental-vm-modules jest",
2020
"test:integrated": "AUTH_MODE=integrated npm test",
2121
"test:separate": "AUTH_MODE=separate npm test",

0 commit comments

Comments
 (0)