diff --git a/src/IdTokenResponse.php b/src/IdTokenResponse.php index 4e10186..c143a8b 100644 --- a/src/IdTokenResponse.php +++ b/src/IdTokenResponse.php @@ -55,17 +55,10 @@ protected function getBuilder( ($this->useMicroseconds ? microtime(true) : time()) ); - if ($this->currentRequestService) { - $uri = $this->currentRequestService->getRequest()->getUri(); - $issuer = $uri->getScheme() . '://' . $uri->getHost() . ($uri->getPort() ? ':' . $uri->getPort() : ''); - } else { - $issuer = 'https://' . $_SERVER['HTTP_HOST']; - } - return $this->config ->builder() ->permittedFor($accessToken->getClient()->getIdentifier()) - ->issuedBy($issuer) + ->issuedBy('https://' . $_SERVER['HTTP_HOST']) ->issuedAt($dateTimeImmutableObject) ->expiresAt($dateTimeImmutableObject->add(new DateInterval('PT1H'))) ->relatedTo($userEntity->getIdentifier()); diff --git a/src/Laravel/DiscoveryController.php b/src/Laravel/DiscoveryController.php index cb7536d..a36d76e 100644 --- a/src/Laravel/DiscoveryController.php +++ b/src/Laravel/DiscoveryController.php @@ -4,6 +4,7 @@ use Illuminate\Http\Request; use Illuminate\Support\Facades\Route; +use Illuminate\Support\Facades\URL; use Laravel\Passport\Passport; class DiscoveryController @@ -13,8 +14,10 @@ class DiscoveryController */ public function __invoke(Request $request) { + URL::forceScheme('https'); // for route() calls below + $response = [ - 'issuer' => url('/'), + 'issuer' => 'https://' . $_SERVER['HTTP_HOST'], 'authorization_endpoint' => route('passport.authorizations.authorize'), 'token_endpoint' => route('passport.token'), 'grant_types_supported' => $this->getSupportedGrantTypes(),