diff --git a/src/Grant/AuthCodeGrant.php b/src/Grant/AuthCodeGrant.php index fc8fec53..2d8fb5db 100644 --- a/src/Grant/AuthCodeGrant.php +++ b/src/Grant/AuthCodeGrant.php @@ -165,12 +165,18 @@ class AuthCodeGrant extends AbstractGrant // Get the required params $clientId = $this->server->getRequest()->request->get('client_id', null); if (is_null($clientId)) { - throw new Exception\InvalidRequestException('client_id'); + $clientId = $this->server->getRequest()->getUser(); + if (is_null($clientId)) { + throw new Exception\InvalidRequestException('client_id'); + } } $clientSecret = $this->server->getRequest()->request->get('client_secret', null); if (is_null($clientSecret)) { - throw new Exception\InvalidRequestException('client_secret'); + $clientSecret = $this->server->getRequest()->getPassword(); + if (is_null($clientSecret)) { + throw new Exception\InvalidRequestException('client_secret'); + } } $redirectUri = $this->server->getRequest()->request->get('redirect_uri', null); diff --git a/src/Grant/ClientCredentialsGrant.php b/src/Grant/ClientCredentialsGrant.php index 786d5d2c..442d6f84 100644 --- a/src/Grant/ClientCredentialsGrant.php +++ b/src/Grant/ClientCredentialsGrant.php @@ -56,12 +56,18 @@ class ClientCredentialsGrant extends AbstractGrant // Get the required params $clientId = $this->server->getRequest()->request->get('client_id', null); if (is_null($clientId)) { - throw new Exception\InvalidRequestException('client_id'); + $clientId = $this->server->getRequest()->getUser(); + if (is_null($clientId)) { + throw new Exception\InvalidRequestException('client_id'); + } } $clientSecret = $this->server->getRequest()->request->get('client_secret', null); if (is_null($clientSecret)) { - throw new Exception\InvalidRequestException('client_secret'); + $clientSecret = $this->server->getRequest()->getPassword(); + if (is_null($clientSecret)) { + throw new Exception\InvalidRequestException('client_secret'); + } } // Validate client ID and client secret diff --git a/src/Grant/PasswordGrant.php b/src/Grant/PasswordGrant.php index 9c2b27e3..6e90aa19 100644 --- a/src/Grant/PasswordGrant.php +++ b/src/Grant/PasswordGrant.php @@ -80,12 +80,18 @@ class PasswordGrant extends AbstractGrant // Get the required params $clientId = $this->server->getRequest()->request->get('client_id', null); if (is_null($clientId)) { - throw new Exception\InvalidRequestException('client_id'); + $clientId = $this->server->getRequest()->getUser(); + if (is_null($clientId)) { + throw new Exception\InvalidRequestException('client_id'); + } } $clientSecret = $this->server->getRequest()->request->get('client_secret', null); if (is_null($clientSecret)) { - throw new Exception\InvalidRequestException('client_secret'); + $clientSecret = $this->server->getRequest()->getPassword(); + if (is_null($clientSecret)) { + throw new Exception\InvalidRequestException('client_secret'); + } } // Validate client ID and client secret diff --git a/src/Grant/RefreshTokenGrant.php b/src/Grant/RefreshTokenGrant.php index 01f5e695..f757560c 100644 --- a/src/Grant/RefreshTokenGrant.php +++ b/src/Grant/RefreshTokenGrant.php @@ -60,12 +60,18 @@ class RefreshTokenGrant extends AbstractGrant { $clientId = $this->server->getRequest()->request->get('client_id', null); if (is_null($clientId)) { - throw new Exception\InvalidRequestException('client_id'); + $clientId = $this->server->getRequest()->getUser(); + if (is_null($clientId)) { + throw new Exception\InvalidRequestException('client_id'); + } } $clientSecret = $this->server->getRequest()->request->get('client_secret', null); if (is_null($clientSecret)) { - throw new Exception\InvalidRequestException('client_secret'); + $clientSecret = $this->server->getRequest()->getPassword(); + if (is_null($clientSecret)) { + throw new Exception\InvalidRequestException('client_secret'); + } } // Validate client ID and client secret