Request a new access token using the refresh token.

@param string $refreshToken

@return string
327541
public function exchangeRefreshToken($refreshToken)
    {
        return $this->client->exchangeRefreshToken(
            $refreshToken,
            $this->clientId,
            $this->clientSecret
        );
    }
1201694
public function refresh_token() {
		if (!isset($this->auth_details['refresh_token']))
			trigger_error('Error refreshing token. There is no refresh token set on this object.', E_USER_ERROR);
		$params = array(
			'grant_type' => 'refresh_token',
			'refresh_token' => $this->auth_details['refresh_token']
		);
		return $this->_request('oauth', $params, self::OAUTH_TOKEN_URL);
	}
492850
public function getRefreshToken($refresh_token)
    {
        $token = $this->collection('refresh_token_table')->findOne(array(
            'refresh_token' => $refresh_token
        ));
        return is_null($token) ? false : $token;
    }
545531
private String getRefreshToken(Token accessToken) {
    JSONObject rawJson = JSONObject.fromObject(accessToken.getRawResponse());
    return rawJson.getString("refresh_token");
  }
500760
public function refreshToken($refreshToken)
  {
    $this->refreshTokenRequest(
        array(
          'client_id' => $this->client->getClassConfig($this, 'client_id'),
          'client_secret' => $this->client->getClassConfig($this, 'client_secret'),
          'refresh_token' => $refreshToken,
          'grant_type' => 'refresh_token'
        )
    );
  }
436309
public function refreshAccessToken($refreshToken)
    {
        $payload = base64_encode($this->getClientId() . ':' . $this->getClientSecret());

        $parameters = [
            'grant_type' => 'refresh_token',
            'refresh_token' => $refreshToken,
        ];

        $headers = [
            'Authorization' => 'Basic ' . $payload,
        ];

        $response = $this->request->account('POST', '/api/token', $parameters, $headers);
        $response = $response['body'];

        if (isset($response->access_token)) {
            $this->accessToken = $response->access_token;
            $this->expirationTime = time() + $response->expires_in;
            $this->scope = isset($response->scope) ? $response->scope : $this->scope;

            if (isset($response->refresh_token)) {
                $this->refreshToken = $response->refresh_token;
            } elseif (empty($this->refreshToken)) {
                $this->refreshToken = $refreshToken;
            }

            return true;
        }

        return false;
    }
1246111
public function getToken($forceRefresh = false)
    {
        $cached = $this->authorization->getAuthorizerAccessToken();

        if ($forceRefresh || empty($cached)) {
            return $this->refreshToken();
        }

        return $cached;
    }
787964
public Response<AccessTokenDetails> refreshAccessToken(final String refreshToken) throws FreesoundClientException {
		final RefreshOAuth2AccessTokenRequest tokenRequest =
				new RefreshOAuth2AccessTokenRequest(clientId, clientSecret, refreshToken);

		return executeQuery(tokenRequest);
	}
1198890
private static function initAccessToken($accessToken)
    {
        if (is_array($accessToken)) {
            return new AccessToken($accessToken);
        } elseif (is_a($accessToken, '\League\OAuth2\Client\Token\AccessToken')) {
            return $accessToken;
        } else {
            return null;
        }
    }
1267727
public function getRefreshToken($refresh_token)
    {
        $sql   = sprintf('SELECT * from %s where refresh_token = :refresh_token', $this->config['refresh_token_table']);
        $token = $this->fetch($sql, compact('refresh_token'));
        if ($token) {
            // convert expires to epoch time
            $token['expires'] = strtotime($token['expires']);
        }

        return $token;
    }
750294
public function refreshToken()
    {
        if (is_null($this->token) || is_null($this->token->getRefreshToken())) {
            return null;
        }

        $grant = new RefreshToken();
        $refreshToken = $this->provider->getAccessToken($grant, [
            'refresh_token' => $this->token->getRefreshToken()
        ]);

        $this->token = $refreshToken;


        return $this->token;
    }
1303390
public function getAccess($code, $refreshToken = false)
    {
        //argument 1 must be a string
        Argument::i()->test(1, 'string');

        //populate fields
        $query = array(
            'client_id'         => $this->client,
            'client_secret'     => $this->secret,
            'redirect_uri'  => $this->redirect,
            'grant_type'    => $this->grantType);

        return $this->generateAccess($query, $code, $refreshToken);
    }
1081575
def refresh_token(self):
        """"""
        if (not self.auth_details or
                not 'refresh_token' in self.auth_details or
                not self.auth_details['refresh_token']):
            raise Exception(
                "auth_details['refresh_token'] does not contain a refresh token.")

        refresh_token = self.auth_details['refresh_token']
        params = [
            ('grant_type', 'refresh_token'),
            ('refresh_token', refresh_token)
        ]
        response = self._post('', urlencode(params),
                              CreateSend.oauth_token_uri, "application/x-www-form-urlencoded")
        new_access_token, new_expires_in, new_refresh_token = None, None, None
        r = json_to_py(response)
        new_access_token, new_expires_in, new_refresh_token = r.access_token, r.expires_in, r.refresh_token
        self.auth({
            'access_token': new_access_token,
            'refresh_token': new_refresh_token})
        return [new_access_token, new_expires_in, new_refresh_token]
1281726
public function setRefreshToken($refresh_token)
    {
        $key = array_search('refresh_token', $this->persistantMap);
        if ($key !== false) {
            $this->store->set('refresh_token', $refresh_token);
        }

        $this->refresh_token = $refresh_token;

        return $this;
    }
681242
public function get($token)
    {
        foreach ($this->getDbConnection()->fetchAll(
            'SELECT * FROM oauth_refresh_token
            WHERE refresh_token = :token', [
                'token' => $token
            ]
        ) as $row) {
            if ($row) {
                return (new RefreshTokenEntity($this->server))
                    ->setAccessTokenId($row['access_token'])
                    ->setExpireTime($row['expire_time'])
                    ->setId($row['refresh_token']);
            }
        }
        return null;
    }
133914
private function getToken($accessTokenParams)
    {
        $kvs = $this->getKeyValueStorage();

        if ($kvs->has(self::ACCESS_TOKEN_KEY) && $kvs->has(self::REFRESH_TOKEN_KEY)) {
            return new AccessToken([
                'access_token' => $kvs->get(self::ACCESS_TOKEN_KEY),
                'expires_in' => $kvs->getTtl(self::ACCESS_TOKEN_KEY),
                'refresh_token' => $kvs->get(self::REFRESH_TOKEN_KEY),
            ]);
        }

        $accessToken = $this->provider->getAccessToken($this->type, $accessTokenParams);
        $this->cacheToken($accessToken);

        return $accessToken;
    }
1267698
public function refreshToken(AccessToken $accessToken)
    {
        // request data
        $refreshToken = $accessToken->getRefreshToken();
        $scope        = $accessToken->getScope();

        if (empty($refreshToken)) {
            throw new RuntimeException('No refresh token was set');
        }

        $data = array(
            'grant_type'    => 'refresh_token',
            'refresh_token' => $refreshToken,
        );

        if (!empty($scope)) {
            $data['scope'] = $scope;
        }

        // authentication
        $header = array();

        if ($this->type == self::AUTH_BASIC) {
            $header['Authorization'] = 'Basic ' . base64_encode($this->clientId . ':' . $this->clientSecret);
        }

        if ($this->type == self::AUTH_POST) {
            $data['client_id']     = $this->clientId;
            $data['client_secret'] = $this->clientSecret;
        }

        $request  = new PostRequest($this->url, $header, $data);
        $response = $this->httpClient->request($request);

        $data = Json\Parser::decode($response->getBody());

        if ($response->getStatusCode() == 200) {
            return $this->newToken($data);
        } else {
            throw new RuntimeException('Could not refresh access token');
        }
    }