From 4fa37bb356ea29d2943a92937985ca70878bd287 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Tue, 29 Jan 2013 16:24:28 +0000 Subject: [PATCH] Updated issueAccessToken method --- src/OAuth2/AuthServer.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/OAuth2/AuthServer.php b/src/OAuth2/AuthServer.php index c83ad822..d6701f81 100644 --- a/src/OAuth2/AuthServer.php +++ b/src/OAuth2/AuthServer.php @@ -255,9 +255,18 @@ class AuthServer */ public function issueAccessToken($authParams = null) { + $params['grant_type'] = (isset($authParams['grant_type'])) ? + $authParams['grant_type'] : + $this->getRequest()->post('grant_type'); - } + if (is_null($params['grant_type'])) { + throw new Exception\ClientException(sprintf($this->errors['invalid_request'], 'grant_type'), 0); + } + // Ensure grant type is one that is recognised and is enabled + if ( ! in_array($params['grant_type'], array_keys($this->grantTypes))) { + throw new Exception\ClientException(sprintf($this->errors['unsupported_grant_type'], $params['grant_type']), 7); + } protected function getCurrentGrantType() {