diff --git a/packages/better-auth/src/plugins/mcp/authorize.ts b/packages/better-auth/src/plugins/mcp/authorize.ts index a95172fa11..9c6a3daf3d 100644 --- a/packages/better-auth/src/plugins/mcp/authorize.ts +++ b/packages/better-auth/src/plugins/mcp/authorize.ts @@ -217,7 +217,7 @@ export async function authorizeMCPOAuth( if (query.prompt !== "consent") { const redirectURIWithCode = new URL(redirectURI); redirectURIWithCode.searchParams.set("code", code); - if(ctx.query.state){ + if (ctx.query.state) { redirectURIWithCode.searchParams.set("state", ctx.query.state); } throw ctx.redirect(redirectURIWithCode.toString()); @@ -245,7 +245,7 @@ export async function authorizeMCPOAuth( // No consent page configured - fall back to direct redirect with code const redirectURIWithCode = new URL(redirectURI); redirectURIWithCode.searchParams.set("code", code); - if(ctx.query.state){ + if (ctx.query.state) { redirectURIWithCode.searchParams.set("state", ctx.query.state); } throw ctx.redirect(redirectURIWithCode.toString());