public function setAccessToken($oauth_token, $client_id, $user_id, $expires, $scope = null)
    {
        // Get Client Entity
        $client = $this->em->getRepository('OAuth2ServerBundle:Client')->find($client_id);

        if (!$client) {
            return null;
        }

        // Create Access Token
        $accessToken = new \OAuth2\ServerBundle\Entity\AccessToken();
        $accessToken->setToken($oauth_token);
        $accessToken->setClient($client);
        $accessToken->setUserId($user_id);
        $accessToken->setExpires($expires);
        $accessToken->setScope($scope);

        // Store Access Token
        $this->em->persist($accessToken);
        $this->em->flush();
    }
public function setAccessToken($oauth_token, $client_id, $user_id, $expires, $scope = null)
    {
        // Get Client Entity
        $client = $this->em->getRepository('OAuth2ServerBundle:Client')->find($client_id);

        if (!$client) {
            return null;
        }

        // Create Access Token
        $accessToken = new \OAuth2\ServerBundle\Entity\AccessToken();
        $accessToken->setToken($oauth_token);
        $accessToken->setClient($client);
        $accessToken->setUserId($user_id);
        $accessToken->setExpires($expires);
        $accessToken->setScope($scope);

        // Store Access Token
        $this->em->persist($accessToken);
        $this->em->flush();
    }
public function setAccessToken ( $ oauth_token , $ client_id , $ user_id , $ expires , $ scope = null ) { // Get Client Entity $ client = $ this -> em -> getRepository ( 'OAuth2ServerBundle:Client' ) -> find ( $ client_id ) ; if ( ! $ client ) { return null ; } // Create Access Token $ accessToken = new \ OAuth2 \ ServerBundle \ Entity \ AccessToken ( ) ; $ accessToken -> setToken ( $ oauth_token ) ; $ accessToken -> setClient ( $ client ) ; $ accessToken -> setUserId ( $ user_id ) ; $ accessToken -> setExpires ( $ expires ) ; $ accessToken -> setScope ( $ scope ) ; // Store Access Token $ this -> em -> persist ( $ accessToken ) ; $ this -> em -> flush ( ) ; }
Store the supplied access token values to storage.

We need to store access token data as we create and verify tokens.

@param $oauth_token
oauth_token to be stored.
@param $client_id
Client identifier to be stored.
@param $user_id
User identifier to be stored.
@param int    $expires
Expiration to be stored as a Unix timestamp.
@param string $scope
(optional) Scopes to be stored in space-separated string.

@ingroup oauth2_section_4
Store the supplied access token values to storage .