diff --git a/lib/OAuth2/OAuth2.php b/lib/OAuth2/OAuth2.php index 5898732..f61a633 100644 --- a/lib/OAuth2/OAuth2.php +++ b/lib/OAuth2/OAuth2.php @@ -723,7 +723,12 @@ public function grantAccessToken(Request $request = NULL) { throw new OAuth2ServerException(self::HTTP_BAD_REQUEST, self::ERROR_INVALID_SCOPE, 'An unsupported scope was requested.'); } - $token = $this->createAccessToken($client, $stored['data'], $stored['scope']); + // grant all possible scopes if the request doesn't pass in a scope value. + if (!$input['scope']) { + $input['scope'] = $stored['scope']; + } + + $token = $this->createAccessToken($client, $stored['data'], $input['scope']); return new Response(json_encode($token), 200, $this->getJsonHeaders()); }