From 4034bea6d10bab6aaf24211a28c7e7eb0f0d35a9 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Mon, 29 Apr 2013 10:36:35 +0100 Subject: [PATCH] Updated client credentials grant --- src/OAuth2/Grant/ClientCredentials.php | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/OAuth2/Grant/ClientCredentials.php b/src/OAuth2/Grant/ClientCredentials.php index 2909132e..680c55fb 100644 --- a/src/OAuth2/Grant/ClientCredentials.php +++ b/src/OAuth2/Grant/ClientCredentials.php @@ -134,22 +134,15 @@ class ClientCredentials implements GrantTypeInterface { $this->authServer->getStorage('session')->deleteSession($authParams['client_id'], 'client', $authParams['client_id']); // Create a new session - $sessionId = $this->authServer->getStorage('session')->createSession( - $authParams['client_id'], - null, - 'client', - $authParams['client_id'], - null, - $accessToken, - null, - $accessTokenExpires, - 'granted' - ); + $sessionId = $this->authServer->getStorage('session')->createSession($authParams['client_id'], 'client', $authParams['client_id']); + + // Add the access token + $accessTokenId = $this->authServer->getStorage('session')->associateAccessToken($sessionId, $accessToken); // Associate scopes with the new session foreach ($authParams['scopes'] as $scope) { - $this->authServer->getStorage('session')->associateScope($sessionId, $scope['id']); + $this->authServer->getStorage('session')->associateScope($accessTokenId, $scope['id']); } $response = array(