Skip to content

Commit 540e637

Browse files
committed
fix(backend): sync OAuth client credentials on re-auth callback
1 parent 92ff509 commit 540e637

File tree

1 file changed

+10
-2
lines changed
  • services/backend/src/routes/mcp/installations

1 file changed

+10
-2
lines changed

services/backend/src/routes/mcp/installations/callback.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,11 +333,19 @@ export default async function oauthCallbackRoute(server: FastifyInstance) {
333333
})
334334
.where(eq(mcpServerInstances.installation_id, flow.installation_id!));
335335

336-
// Update installation OAuth pending flag
336+
// Update installation OAuth config + pending flag
337+
// Re-auth performs new DCR registration, so oauth_client_id/secret
338+
// must be updated for the token refresh cron job to work correctly
337339
await db
338340
.update(mcpServerInstallations)
339341
.set({
340-
oauth_pending: false
342+
oauth_pending: false,
343+
oauth_client_id: flow.oauth_client_id,
344+
oauth_client_secret: flow.oauth_client_secret,
345+
oauth_provider_id: flow.oauth_provider_id || null,
346+
oauth_token_endpoint: flow.oauth_token_endpoint,
347+
oauth_token_endpoint_auth_method: flow.oauth_token_endpoint_auth_method,
348+
updated_at: new Date()
341349
})
342350
.where(eq(mcpServerInstallations.id, flow.installation_id!));
343351

0 commit comments

Comments
 (0)