@@ -40,6 +40,7 @@ Based on your server logs, I identified several critical issues preventing prope
4040 "authorization_endpoint" : " https://your-domain.com/oauth/authorize" ,
4141 "token_endpoint" : " https://your-domain.com/api/oauth/token" ,
4242 "registration_endpoint" : " https://your-domain.com/api/oauth/register" ,
43+ "grant_types_supported" : [" authorization_code" , " refresh_token" ],
4344 "code_challenge_methods_supported" : [" S256" , " plain" ],
4445 "resource_parameter_supported" : true
4546}
@@ -53,10 +54,10 @@ Based on your server logs, I identified several critical issues preventing prope
5354{
5455 "resource" : " https://your-domain.com" ,
5556 "authorization_servers" : [" https://your-domain.com" ],
56- "mcp_endpoints" : [
57- " https://your-domain.com/mcp/mcp" ,
58- " https://your-domain.com/mcp/sse"
59- ]
57+ "mcp_endpoints" : {
58+ "http_stream" : " https://your-domain.com/mcp/mcp" ,
59+ "sse" : " https://your-domain.com/mcp/sse"
60+ }
6061}
6162```
6263
@@ -88,9 +89,9 @@ if (accessToken.resource && accessToken.resource !== currentResource) {
8889```
8990
9091#### 6. ** Registration Endpoint Path**
91- ** Problem** : Clients expected ` /register ` but you had ` /api/oauth/register `
92- ** Impact** : Dynamic client registration failed
93- ** Fix** : Added redirect endpoint at ` / register`
92+ ** Problem** : Registration endpoint path needed to be properly advertised
93+ ** Impact** : Dynamic client registration endpoint discoverability
94+ ** Fix** : Proper endpoint advertising in authorization server metadata ( ` /api/oauth/ register` )
9495
9596## Security Improvements
9697
@@ -147,7 +148,7 @@ sequenceDiagram
147148 M->>C: Resource metadata + authorization_servers
148149
149150 C->>A: GET /.well-known/oauth-authorization-server
150- A->>C: Authorization server metadata
151+ A->>C: Authorization server metadata (includes refresh_token grant)
151152
152153 C->>A: POST /register (dynamic client registration)
153154 A->>C: client_id + client_secret
@@ -156,10 +157,23 @@ sequenceDiagram
156157 A->>C: Authorization code
157158
158159 C->>A: Token request + resource parameter
159- A->>C: Access token (bound to resource )
160+ A->>C: Access token + refresh token (expires_in: 300 )
160161
161162 C->>M: MCP request + Authorization: Bearer token
162163 M->>C: MCP response (token validated for audience)
164+
165+ Note over C,M: MCP communication continues...
166+ Note over C: After 5 minutes, access token expires
167+
168+ C->>M: MCP request + Authorization: Bearer (expired token)
169+ M->>C: 401 Unauthorized
170+
171+ Note over C: Client detects expiry, uses refresh token
172+ C->>A: POST /token (grant_type=refresh_token + resource)
173+ A->>C: New access token + new refresh token
174+
175+ C->>M: MCP request + Authorization: Bearer (new token)
176+ M->>C: MCP response (seamless continuation)
163177```
164178
165179## Testing Your Implementation
@@ -179,7 +193,7 @@ After deploying these changes, verify:
179193
1801943 . ** Registration endpoint accessible** :
181195 ``` bash
182- curl -X POST https://your-domain.com/register \
196+ curl -X POST https://your-domain.com/api/oauth/ register \
183197 -H " Content-Type: application/json" \
184198 -d ' {"client_name": "Test", "redirect_uris": ["http://localhost:3000"]}'
185199 ```
@@ -204,7 +218,8 @@ Test token endpoint with refresh_token grant:
204218``` bash
205219# First get tokens via authorization flow, then test refresh
206220curl -X POST https://your-domain.com/api/oauth/token \
207- -d " grant_type=refresh_token&refresh_token=your_refresh_token&client_id=your_client_id"
221+ -H " Content-Type: application/x-www-form-urlencoded" \
222+ -d " grant_type=refresh_token&refresh_token=your_refresh_token&client_id=your_client_id&resource=https://your-domain.com"
208223```
209224
210225### Testing Refresh Token Flow
0 commit comments