public function refreshAccessToken($refresh_token = null) {
        $return = array();
        if ($refresh_token) {
            // todo get access_token via refresh_token request
            $params['client_id']     = $this->getClientID();
            $params['client_secret'] = $this->getClientSecret();
            $params['redirect_uri']  = $this->getRedirectUri();
            $params['grant_type']    = 'refresh_token';
            $params['scope']         = '';
            $params['state']         = '';
            $params['refresh_token'] = $refresh_token;
            $return = (array) json_decode($this->makeRequest($this->getTokenURL(), $params));
        }
        if (is_array($return) && isset($return['access_token'])) {
            $this->session = $return;
            if (isset($return['access_token'])) {
                $this->setAccessToken($return['access_token']);
            }
            if (isset($return['refresh_token'])) {
                $this->setRefreshToken($return['refresh_token']);
            }
        } else {
            // No success! Defaults to
            $this->setAccessToken($this->getClientID());
        }
        return $this->getAccessToken();
    }
public function refreshAccessToken($refresh_token = null) {
        $return = array();
        if ($refresh_token) {
            // todo get access_token via refresh_token request
            $params['client_id']     = $this->getClientID();
            $params['client_secret'] = $this->getClientSecret();
            $params['redirect_uri']  = $this->getRedirectUri();
            $params['grant_type']    = 'refresh_token';
            $params['scope']         = '';
            $params['state']         = '';
            $params['refresh_token'] = $refresh_token;
            $return = (array) json_decode($this->makeRequest($this->getTokenURL(), $params));
        }
        if (is_array($return) && isset($return['access_token'])) {
            $this->session = $return;
            if (isset($return['access_token'])) {
                $this->setAccessToken($return['access_token']);
            }
            if (isset($return['refresh_token'])) {
                $this->setRefreshToken($return['refresh_token']);
            }
        } else {
            // No success! Defaults to
            $this->setAccessToken($this->getClientID());
        }
        return $this->getAccessToken();
    }
public function refreshAccessToken ( $ refresh_token = null ) { $ return = array ( ) ; if ( $ refresh_token ) { // todo get access_token via refresh_token request $ params [ 'client_id' ] = $ this -> getClientID ( ) ; $ params [ 'client_secret' ] = $ this -> getClientSecret ( ) ; $ params [ 'redirect_uri' ] = $ this -> getRedirectUri ( ) ; $ params [ 'grant_type' ] = 'refresh_token' ; $ params [ 'scope' ] = '' ; $ params [ 'state' ] = '' ; $ params [ 'refresh_token' ] = $ refresh_token ; $ return = ( array ) json_decode ( $ this -> makeRequest ( $ this -> getTokenURL ( ) , $ params ) ) ; } if ( is_array ( $ return ) && isset ( $ return [ 'access_token' ] ) ) { $ this -> session = $ return ; if ( isset ( $ return [ 'access_token' ] ) ) { $ this -> setAccessToken ( $ return [ 'access_token' ] ) ; } if ( isset ( $ return [ 'refresh_token' ] ) ) { $ this -> setRefreshToken ( $ return [ 'refresh_token' ] ) ; } } else { // No success! Defaults to $ this -> setAccessToken ( $ this -> getClientID ( ) ) ; } return $ this -> getAccessToken ( ) ; }
Gets a Fresh OAuth access token based on a refresh token

@param string $refresh_token
@return string the refresh token
Gets a Fresh OAuth access token based on a refresh token