File tree Expand file tree Collapse file tree
packages/plugins/plugin-auth/src Expand file tree Collapse file tree Original file line number Diff line number Diff 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 } )` ,
You can’t perform that action at this time.
0 commit comments