diff --git a/src/Uri/RouteUrlWriter.php b/src/Uri/RouteUrlWriter.php index 4507c510..c13a76f8 100644 --- a/src/Uri/RouteUrlWriter.php +++ b/src/Uri/RouteUrlWriter.php @@ -62,6 +62,10 @@ public function absoluteUrlFor(string $routeName, array $params = []): ?string ? 'https' : 'http'; + // Strip default port to avoid redirect_uri mismatches with strict OIDC providers. + $defaultPort = $scheme === 'https' ? '443' : '80'; + $host = preg_replace('/^(.+):' . $defaultPort . '$/', '$1', $host); + return $scheme . '://' . $host . $path; }