刷新access_token (第三方平台开发)
@param appid appid
@param refresh_token refresh_token
@param component_appid 服务开发商的appid
@param component_access_token 服务开发方的access_token
@return SnsToken
326500
public static SnsToken oauth2ComponentRefreshToken(String appid,String refresh_token,String component_appid,String component_access_token){
		HttpUriRequest httpUriRequest = RequestBuilder.post()
				.setUri(BASE_URI + "/sns/oauth2/component/refresh_token")
				.addParameter("appid", appid)
				.addParameter("refresh_token", refresh_token)
				.addParameter("grant_type", "refresh_token")
				.addParameter("component_appid", component_appid)
				.addParameter("component_access_token", component_access_token)
				.build();
		return LocalHttpClient.executeJsonResult(httpUriRequest,SnsToken.class);
	}
602168
public static UpdateResult update(String accessToken, UpdateGift updateGift) {
		return update(accessToken, JsonUtil.toJSONString(updateGift));
	}
393121
private function refreshAccessToken(Provider $provider, $userId, AccessToken $accessToken)
    {
        // prepare access_token request
        $tokenRequestData = [
            'grant_type' => 'refresh_token',
            'refresh_token' => $accessToken->getRefreshToken(),
            'scope' => $accessToken->getScope(),
        ];

        $response = $this->httpClient->send(
            Request::post(
                $provider->getTokenEndpoint(),
                $tokenRequestData,
                self::getAuthorizationHeader(
                    $provider->getClientId(),
                    $provider->getSecret()
                )
            )
        );

        if (false === $response->isOkay()) {
            $responseData = $response->json();
            if (\array_key_exists('error', $responseData) && 'invalid_grant' === $responseData['error']) {
                // delete the access_token, we assume the user revoked it, that
                // is why we get "invalid_grant"
                $this->tokenStorage->deleteAccessToken($userId, $accessToken);

                return false;
            }

            throw new TokenException('unable to refresh access_token', $response);
        }

        // delete old AccessToken as we'll write a new one anyway...
        $this->tokenStorage->deleteAccessToken($userId, $accessToken);

        $accessToken = AccessToken::fromRefreshResponse(
            $provider,
            $this->dateTime,
            $response->json(),
            // provide the old AccessToken to borrow some fields if the server
            // does not provide them on "refresh"
            $accessToken
        );

        // store the refreshed AccessToken
        $this->tokenStorage->storeAccessToken($userId, $accessToken);

        return $accessToken;
    }
708528
public StoredCredential setRefreshToken(String refreshToken) {
    lock.lock();
    try {
      this.refreshToken = refreshToken;
    } finally {
      lock.unlock();
    }
    return this;
  }
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]
545531
private String getRefreshToken(Token accessToken) {
    JSONObject rawJson = JSONObject.fromObject(accessToken.getRawResponse());
    return rawJson.getString("refresh_token");
  }
469319
public static BaseResult shopUpdate(String accessToken, ShopUpdate shopUpdate) {
        return shopUpdate(accessToken, JsonUtil.toJSONString(shopUpdate));
    }
665279
public Credential setRefreshToken(String refreshToken) {
    lock.lock();
    try {
      if (refreshToken != null) {
        Preconditions.checkArgument(jsonFactory != null && transport != null
            && clientAuthentication != null && tokenServerEncodedUrl != null,
            "Please use the Builder and call setJsonFactory, setTransport, setClientAuthentication"
            + " and setTokenServerUrl/setTokenServerEncodedUrl");
      }
      this.refreshToken = refreshToken;
    } finally {
      lock.unlock();
    }
    return this;
  }
1276130
def delete_refresh_token(self, refresh_token):
        
        access_token = self.fetch_by_refresh_token(refresh_token)
        self.mc.delete(self._generate_cache_key(access_token.token))
        self.mc.delete(self._generate_cache_key(refresh_token))
317671
async def refresh_token(self, refresh_token):
        
        async with self._client_session() as client:
            well_known = await self._get_well_known(client)

            try:
                return await self._post(
                    client,
                    well_known['token_endpoint'],
                    data={
                        'grant_type': GRANT_TYPE_REFRESH_TOKEN,
                        'refresh_token': refresh_token,
                    }
                )
            except aiohttp.ClientResponseError as e:
                raise ConfigException('oidc: failed to refresh access token')
1324736
def refresh_access_token(self):
        
        if self.client_secret is None:
            raise Exception("client_secret must be set to execute "
                            "refresh_access_token.")
        if self.refresh_token is None:
            raise Exception("refresh_token must be set to execute "
                            "refresh_access_token.")
        params = {'client_id': self.client_id,
                  'client_secret': self.client_secret,
                  'grant_type': 'refresh_token',
                  'refresh_token': self.refresh_token}
        result = self._send_request(REFRESH_URL.format(self._base_url),
                                    params=params, method='POST',
                                    data_field=None)
        self.access_token = result['access_token']
        return self.access_token
227705
def refresh_access_token(self, refresh_token, redirect_uri=None):
        '''
        
        '''
        redirect = redirect_uri or self._redirect_uri
        resp_text = _http('POST', 'https://graph.qq.com/oauth2.0/token',
                          refresh_token=refresh_token,
                          client_id=self._client_id, client_secret=self._client_secret,
                          redirect_uri=redirect, grant_type='refresh_token')
        return self._parse_access_token(resp_text)
80874
public function getTokenByRefreshToken($authorizerAppId, $refreshToken)
    {
        $body = $this->parseJSON('json', [
            self::API_GET_AUTHORIZER_ACCESSTOKEN,
            [
                'component_appid'          => $this->getAccessToken()->getAppId(),
                'authorizer_appid'         => $authorizerAppId,
                'authorizer_refresh_token' => $refreshToken
            ]
        ]);

        return $body;
    }
62979
private function refreshToken()
    {

        // Make the post request for a new access_token
        $response = $this->httpRequest('post',
            $this->sso_base . '/token/?grant_type=refresh_token&refresh_token=' .
            $this->authentication->refresh_token, [
                'Authorization' => 'Basic ' . base64_encode(
                        $this->authentication->client_id . ':' . $this->authentication->secret),
            ]
        );

        // Get the current EsiAuth container
        $authentication = $this->getAuthentication();

        // Set the new authentication values from the request
        $authentication->access_token = $response->access_token;
        $authentication->refresh_token = $response->refresh_token;
        $authentication->token_expires = carbon('now')
            ->addSeconds($response->expires_in);

        // ... and update the container
        $this->setAuthentication($authentication);
    }
1211447
protected function getAuthorizerConfig(string $appId, string $refreshToken = null): array
    {
        return $this['config']->merge([
            'component_app_id' => $this['config']['app_id'],
            'app_id' => $appId,
            'refresh_token' => $refreshToken,
        ])->toArray();
    }
78046
public function refreshToken($accessToken = null)
    {
        $accessToken = $accessToken ?: $this->accessToken;
        $this->accessToken = $this->provider->getAccessToken('refresh_token', [
            'refresh_token' => $accessToken->getRefreshToken()
        ]);
        return $this->accessToken;
    }
98979
public function getOauthRefreshToken($refresh_token)
    {
        $appid = $this->config->get('appid');
        $url = "https://api.weixin.qq.com/sns/oauth2/refresh_token?appid={$appid}&grant_type=refresh_token&refresh_token={$refresh_token}";
        return $this->httpGetForJson($url);
    }