标签管理 获取公众号已创建的标签
@since 2.8.1
@param access_token access_token
@return result
10988
public static TagsGetResult tagsGet(String access_token){
		HttpUriRequest httpUriRequest = RequestBuilder.get()
				.setUri(BASE_URI+"/cgi-bin/tags/get")
				.addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token))
				.build();
		return LocalHttpClient.executeJsonResult(httpUriRequest,TagsGetResult.class);
	}
232516
public function getAccessToken($access_token)
    {
        $token = $this->getObjectByType('access_token_table',$access_token);

        return is_null($token) ? false : $token;
    }
513208
public function setAccessToken($access_token)
    {
        if (!is_string($access_token)) {
            throw new InvalidArgumentException("Invalid AccessToken type, need string.");
        }
        $cache = $this->config->get('appid') . '_access_token';
        Tools::setCache($cache, $this->access_token = $access_token);
    }
723756
def revoke_access_token(self):
        

        if not self._access_token:
            return

        self.execute_post('authentication/revoke', json=dict(
            token_type_hint='access_token',
            token=self._access_token
        ))

        self._access_token = None
642963
public static AccountAuditStatusResult accountAuditStatus(String accessToken) {
        HttpUriRequest httpUriRequest = RequestBuilder.post()
                .setHeader(jsonHeader)
                .setUri(BASE_URI + "/shakearound/account/auditstatus")
                .addParameter(PARAM_ACCESS_TOKEN, API.accessToken(accessToken)).build();
        return LocalHttpClient.executeJsonResult(httpUriRequest,
                AccountAuditStatusResult.class);
    }
952920
public function get_access_token()
    {
        $token = false;
        if ($this->get_access_token_diy !== false) {
            // 调用用户自定义获取AccessToken方法
            $token = call_user_func($this->get_access_token_diy);
            if ($token) {
                $token = json_decode($token);
            }
        } else {
            // 异常处理: 获取access_token方法未定义
            @error_log('Not set get_tokenDiy method, AccessToken will be refreshed each time.', 0);
        }
        // 验证AccessToken是否有效        
        if (!$this->valid_access_token($token)) {

            // 生成新的AccessToken
            $token = $this->new_access_token();
            if ($token === false) {
                return false;
            }

            // 保存新生成的AccessToken
            if ($this->save_access_token_diy !== false) {
                // 用户自定义保存AccessToken方法    
                call_user_func($this->save_access_token_diy, json_encode($token));
            } else {
                // 异常处理: 保存access_token方法未定义
                @error_log('Not set saveTokenDiy method, AccessToken will be refreshed each time.', 0);
            }
        }
        return $token->access_token;
    }
1343034
def get_access_token(self, code, client_id, client_secret):
        ''' 
        
        '''
        headers = {
                'Content-Type' : 'application/json'
                }
        data = {
                'client_id' : client_id,
                'client_secret' : client_secret,
                'code' : code,
                }
        str_data = json.dumps(data)
        response = requests.request(method='POST', url=ACCESS_TOKEN_URL, headers=headers, data=str_data)
        status_code = response.status_code
        if status_code != 200:
            raise ValueError("{} -- {}".format(status_code, response.json()))
        return body['access_token']
581811
public static OpenPluginTokenResult openpluginToken(String accessToken, OpenPluginToken openPluginToken) {
        return openpluginToken(accessToken, JsonUtil.toJSONString(openPluginToken));
    }
673817
public function vaildAccessToken(string $access_token, string $open_id)
    {
        $data = [
            'access_token' => $access_token,
            'openid' => $open_id,
        ];
        $url = self::WECHAT.'auth?'.http_build_query($data);
        $data = $this->curl->get($url);

        return Response::json($data);
    }
264602
def save_token(self, access_token):
        
        self.access_tokens[access_token.token] = access_token

        unique_token_key = self._unique_token_key(access_token.client_id,
                                                  access_token.grant_type,
                                                  access_token.user_id)

        self.unique_token_identifier[unique_token_key] = access_token.token

        if access_token.refresh_token is not None:
            self.refresh_tokens[access_token.refresh_token] = access_token

        return True
750201
def access_token(self, request_token, request_secret):
        """"""
        logging.debug("Getting access token from %s:%d",
                      self.server, self.port)
        self.access_token, self.access_secret = \
            self._token("/oauth/accessToken", request_token, request_secret)
        return self.access_token, self.access_secret
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();
                });
    }
134735
public function userinfo($access_token)
    {
        return $this->apiClient->get()
        ->userinfo()
        ->withHeader(new ContentType('application/json'))
        ->withHeader(new AuthorizationBearer($access_token))
        ->call();
    }
1264129
def access_token
      @access_token ||= ShakeTheCounter::Authentication.renew_access_token(client_id: id, client_secret: secret, refresh_token: refresh_token)["access_token"]
    end
216120
public function new_access_token()
    {
        $url = self::API_DOMAIN . 'cgi-bin/token?grant_type=client_credential&appid=' . $this->appId . '&secret=' . $this->appSecret;
        $res = HttpCurl::get($url, 'json');

        // 异常处理: 获取access_token网络错误
        if ($res === false) {
            @error_log('Http Get AccessToken Error.', 0);
            return false;            
        }

        // 异常处理: access_token获取失败
        if (!isset($res->access_token)) {
            @error_log('Get AccessToken Error: ' . json_encode($res), 0);
            return false;
        }
        $res->expires_in += time();
        return $res;
    }
1044471
public function setAccessToken($token)
    {
        $accessTokenAttribute = $this->accessTokenAttribute;
        return (is_string($accessTokenAttribute) && !empty($accessTokenAttribute)) ? $this->$accessTokenAttribute = $token : null;
    }
659148
public function getAccessToken($access_token)
    {
        $token = $this->collection('access_token_table')->findOne(array('access_token' => $access_token));
        return is_null($token) ? false : $token;
    }