public function acquireAccessToken($code)
    {
        if (! $this->credentials) {

            $this->credentials = new Credentials('authorization_code');

            // Get API endpoints
            $this->endpointDiscovery();

            // Acquire the tokens and expiration and save
            $body = $this->acquireToken($code);
            $this->credentials->set($body);

            // Get user Info
            $userInfo = $this->acquireUserInfo();
            $this->credentials->set('userInfo', $userInfo);

            // Add credentials to the session
            $creds = serialize($this->credentials);
            Session::put('creds', $creds);
        }

        return $this;
    }
public function acquireAccessToken($code)
    {
        if (! $this->credentials) {

            $this->credentials = new Credentials('authorization_code');

            // Get API endpoints
            $this->endpointDiscovery();

            // Acquire the tokens and expiration and save
            $body = $this->acquireToken($code);
            $this->credentials->set($body);

            // Get user Info
            $userInfo = $this->acquireUserInfo();
            $this->credentials->set('userInfo', $userInfo);

            // Add credentials to the session
            $creds = serialize($this->credentials);
            Session::put('creds', $creds);
        }

        return $this;
    }
public function acquireAccessToken ( $ code ) { if ( ! $ this -> credentials ) { $ this -> credentials = new Credentials ( 'authorization_code' ) ; // Get API endpoints $ this -> endpointDiscovery ( ) ; // Acquire the tokens and expiration and save $ body = $ this -> acquireToken ( $ code ) ; $ this -> credentials -> set ( $ body ) ; // Get user Info $ userInfo = $ this -> acquireUserInfo ( ) ; $ this -> credentials -> set ( 'userInfo' , $ userInfo ) ; // Add credentials to the session $ creds = serialize ( $ this -> credentials ) ; Session :: put ( 'creds' , $ creds ) ; } return $ this ; }
Use the Authorization Code to get an Access Token

@param $code
@return oAuthAuthorizationCode
Use the Authorization Code to get an Access Token