更改Code
@param accessToken accessToken
@param codeUpdate codeUpdate
@return result
187250
public static BaseResult codeUpdate(String accessToken, CodeUpdate codeUpdate) {
		return codeUpdate(accessToken, JsonUtil.toJSONString(codeUpdate));
	}
564606
public static CodeDecryptResult codeDecrypt(String accessToken, CodeDecrypt codeDecrypt) {
		return codeDecrypt(accessToken, JsonUtil.toJSONString(codeDecrypt));
	}
1133870
public Credential setAccessToken(String accessToken) {
    lock.lock();
    try {
      this.accessToken = accessToken;
    } finally {
      lock.unlock();
    }
    return this;
  }
662689
public static CategoryListResult getWxCategory(String accessToken) {
		HttpUriRequest httpUriRequest = RequestBuilder.post()
				.setUri(BASE_URI + "/cgi-bin/poi/getwxcategory")
				.addParameter(PARAM_ACCESS_TOKEN, API.accessToken(accessToken)).build();
		return LocalHttpClient.executeJsonResult(httpUriRequest,
				CategoryListResult.class);
	}
1023383
public void setAccessToken(String accessToken) {
        for (Authentication auth : authentications.values()) {
            if (auth instanceof OAuth) {
                ((OAuth) auth).setAccessToken(accessToken);
                return;
            }
        }
        throw new RuntimeException("No OAuth2 authentication configured!");
    }
1259428
public Maybe<AccessToken> isValidToken(String token) {
        return db.findAccessToken(token)
                .flatMap(accessToken -> {
                    LOG.info("token详情:" + accessToken);
                    if (accessToken != null && accessToken.isValid()) {
                        if (accessToken.tokenExpired()) {
                            LOG.info(new JSONObject()
                                    //todo 设计一个打印type日志的Java类，将结构固定下来
                                    .fluentPut("description", "accessToken has expired, client_id= " + accessToken.getClientId())
                                    .fluentPut("accessToken", accessToken)
                                    .fluentPut("type", LogTypeOAuth20.oAuth20TokenExpired));
                            db.updateAccessTokenValidStatus(accessToken.getToken(), false).subscribe();
                            // return empty result if token expired.
                            return Maybe.empty();
                        }
                        return Maybe.just(accessToken);
                    }
                    return Maybe.empty();
                });
    }
692784
public OAuthAccessToken refreshToken(RequestContext requestContext, OAuthAccessToken token) {
    OAuthAccessToken result = token;
    
    String[] scopes = token.getScopes();
    String tokenUrl = String.format("%s/realms/%s/protocol/openid-connect/token", getServerUrl(), getRealm());
    
    HttpPost httpPost = new HttpPost(tokenUrl);
    
    try (CloseableHttpClient httpclient = HttpClients.createDefault()) {
      List<NameValuePair> params = new ArrayList<NameValuePair>();
      params.add(new BasicNameValuePair("client_id", getApiKey()));
      params.add(new BasicNameValuePair("client_secret", getApiSecret()));
      params.add(new BasicNameValuePair("grant_type", "refresh_token"));
      params.add(new BasicNameValuePair("refresh_token", token.getRefreshToken()));

      httpPost.setEntity(new UrlEncodedFormEntity(params));
      try (CloseableHttpResponse response = httpclient.execute(httpPost)) {
        StatusLine statusLine = response.getStatusLine();
        
        if (statusLine.getStatusCode() == 200) {
          HttpEntity entity = response.getEntity();
          
          ObjectMapper objectMapper = new ObjectMapper();
          try (InputStream stream = entity.getContent()) {
            RefreshTokenResponse refreshTokenResponse = objectMapper.readValue(stream, RefreshTokenResponse.class);
            Date expiresAt = getExpiresAt(refreshTokenResponse.getExpiresIn());
            result = new OAuthAccessToken(token.getExternalId(), refreshTokenResponse.getAccessToken(), refreshTokenResponse.getRefreshToken(), expiresAt, scopes);
            AuthUtils.purgeOAuthAccessTokens(requestContext, getName());
            AuthUtils.storeOAuthAccessToken(requestContext, getName(), result);            
          }
          
          EntityUtils.consume(entity);
        } else {
          logger.log(Level.WARNING, String.format("Failed to refresh access token with message [%d]: %s", statusLine.getStatusCode(), statusLine.getReasonPhrase()));
        }
      }
    } catch (IOException e) {
      logger.log(Level.WARNING, "Failed to refresh access token", e);
    }
    
    return result;
  }
55975
public static UpdateResult update(String accessToken,
			UpdateDiscount updateDiscount) {
		return update(accessToken, JsonUtil.toJSONString(updateDiscount));
	}
236791
public StoredCredential setAccessToken(String accessToken) {
    lock.lock();
    try {
      this.accessToken = accessToken;
    } finally {
      lock.unlock();
    }
    return this;
  }
989184
def refresh(self, access_token=None, **kwargs):
        
        if not self.token_lock.locked():
            with self.token_lock:
                if access_token == self.access_token or access_token is None:
                    if self.developer_token is not None:
                        r = self._httpclient.request(
                            method='POST',
                            url=self.developer_token_url,
                            path='/request_token',
                            headers={
                                'Authorization': 'Bearer {}'.format(
                                    self.developer_token
                                )
                            },
                            timeout=30,
                            raise_for_status=True
                        )

                    elif all(
                        [
                            self.client_id,
                            self.client_secret,
                            self.refresh_token
                        ]
                    ):
                        data = {
                            'client_id': self.client_id,
                            'client_secret': self.client_secret,
                            'refresh_token': self.refresh_token,
                            'grant_type': 'refresh_token'
                        }
                        r = self._httpclient.request(
                            method='POST',
                            url=self.token_url,
                            json=data,
                            path='/api/oauth2/RequestToken',
                            **kwargs
                        )
                    else:
                        raise PartialCredentialsError(
                            "Missing one or more required credentials"
                        )

                    if r:
                        if not r.ok:
                            raise PanCloudError(
                                '%s %s: %s' % (
                                r.status_code, r.reason, r.text)
                            )
                        try:
                            r_json = r.json()
                        except ValueError as e:
                            raise PanCloudError("Invalid JSON: %s" % e)
                        else:
                            if r.json().get(
                                'error_description'
                            ) or r.json().get(
                                'error'
                            ):
                                raise PanCloudError(r.text)
                            self.access_token = r_json.get(
                                'access_token', None
                            )
                            self.jwt_exp = self._decode_exp(
                                self.access_token_)
                            if r_json.get('refresh_token', None):
                                self.refresh_token = \
                                    r_json.get('refresh_token')
                            self.write_credentials()
                        return self.access_token_
894830
def access_token(self, code):
        '''
        '''
        parameters = {"code": code}
        access_uri = "/".join([BASE_URL, API_VERSION, ACCESS_TOKEN])
        # RFC non-compliant response prevents use of standard OAuth modules
        success, response = self._request(access_uri, parameters)
        if success:
            return response['response']['data']['access_token']
        else:
            raise PushedAPIError(
                response['error']['type'],
                response['error']['message']
            )
357009
public static PageUpdateResult pageUpdate(String accessToken,
                                              PageUpdate pageUpdate) {
        return pageUpdate(accessToken, JsonUtil.toJSONString(pageUpdate));
    }
338973
@Nonnull
  public static AccessToken createAccessTokenValidFromNow (@Nullable final String sTokenString)
  {
    // Length 66 so that the Base64 encoding does not add the "==" signs
    // Length must be dividable by 3
    final String sRealTokenString = StringHelper.hasText (sTokenString) ? sTokenString : createNewTokenString (66);
    return new AccessToken (sRealTokenString, PDTFactory.getCurrentLocalDateTime (), null, new RevocationStatus ());
  }
749331
public static BaseResult codeUnavailable(String accessToken, CodeUnavailable codeUnavailable) {
		return codeUnavailable(accessToken,
				JsonUtil.toJSONString(codeUnavailable));
	}
786957
public static BoxAPIConnection getTransactionConnection(String accessToken, String scope) {
        return BoxTransactionalAPIConnection.getTransactionConnection(accessToken, scope, null);
    }
790048
public final B accessToken(String accessToken) {
        requireNonNull(accessToken, "accessToken");
        checkArgument(!accessToken.isEmpty(), "accessToken is empty.");
        this.accessToken = accessToken;
        return self();
    }
815382
@Nonnull
  public IHasJSCode getJSUpdateCode (@Nonnull final IJSExpression aJSDataVar)
  {
    final JSPackage ret = new JSPackage ();
    // Cleanup old chart
    ret.invoke (JSExpr.ref (getJSChartVar ()), "destroy");
    // Use new chart
    ret.assign (JSExpr.ref (getJSChartVar ()), new JSDefinedClass ("Chart")._new ()
                                                                           .arg (JSExpr.ref (getCanvasID ())
                                                                                       .invoke ("getContext")
                                                                                       .arg ("2d"))
                                                                           .invoke (m_aChart.getJSMethodName ())
                                                                           .arg (aJSDataVar)
                                                                           .arg (getJSOptions ()));
    return ret;
  }