Skip to content

Commit aab77d5

Browse files
committed
fix vercel
1 parent 814a600 commit aab77d5

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

packages/plugins/plugin-auth/src/auth-plugin.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,12 @@ export class AuthPlugin implements Plugin {
157157
const configuredOrigin = new URL(configuredUrl).origin;
158158
const actualUrl = `http://localhost:${actualPort}`;
159159

160-
if (configuredOrigin !== actualUrl) {
160+
// Only auto-correct the port when the configured URL is already a
161+
// localhost URL (development mode). In production (Vercel/cloud) the
162+
// configured baseUrl is the real public hostname — never overwrite it
163+
// with a localhost URL, which would break OAuth callback URLs.
164+
const configuredIsLocalhost = configuredOrigin.startsWith('http://localhost');
165+
if (configuredIsLocalhost && configuredOrigin !== actualUrl) {
161166
this.authManager.setRuntimeBaseUrl(actualUrl);
162167
ctx.logger.info(
163168
`Auth baseUrl auto-updated to ${actualUrl} (configured: ${configuredUrl})`,

0 commit comments

Comments
 (0)