Refreshes the access token for partner API type applications

@param string $accessToken
the current access token for the session
@param string $sessionHandle
the current session handle for the session
@return array response array from request
342971
function refreshToken($accessToken, $sessionHandle) {
		$code = $this->request ( 'GET', $this->url ( 'AccessToken', '' ), array (
				'oauth_token' => $accessToken,
				'oauth_session_handle' => $sessionHandle 
		) );
		if ($this->response ['code'] == 200) {
			
			$response = $this->extract_params ( $this->response ['response'] );
			
			return $response;
		} else {
			$this->response ['helper'] = "TokenFatal";
			return $this->response;
		}
	}
598868
public function setAccessToken(?string $accessToken, string $tokenName = null)
    {
        $name = $this->config->getKey($tokenName);
        $cacheKey = $this->creteCacheKey($name);

        if (null === $accessToken) {
            $this->pool->deleteItem($cacheKey);

            return;
        }

        $item = $this->pool->getItem($cacheKey)->set(new AccessToken($name, $accessToken));
        $this->pool->save($item);
    }
829614
public function refreshAccessToken($refreshToken, $expiresIn = null)
    {
        $parameters = [
            'grant_type' => 'refresh_token',
            'refresh_token' => $refreshToken,
        ];

        if ($expiresIn != null) {
            $parameters['expires_in'] = $expiresIn;
        }

        return $this->tokenRequest('oauth2/token', $parameters);
    }
827969
public function send(EncodedPayload $payload, $accessToken)
    {
        if (empty($this->fluentLogger)) {
            $this->loadFluentLogger();
        }

        $scrubbedPayload = $payload->data();
        
        $success = $this->fluentLogger->post($this->fluentTag, $scrubbedPayload);
        $status = $success ? 200 : 400;
        $info = $success ? 'OK' : 'Bad Request';
        $uuid = $scrubbedPayload['data']['uuid'];

        return new Response($status, $info, $uuid);
    }
211414
public function issueToken(IAccessToken $accessToken)
    {
        $scopes = $accessToken->getScopes();

        // in case of doctrine collections, etc
        if ($scopes instanceof \Traversable) {
            $scopes = iterator_to_array($scopes);
        }

        return $this->refreshTokenStorage->generate(
            $accessToken->getUser(),
            $accessToken->getClient(),
            $scopes
        );
    }
735820
public function Update($tokenName, $accessLevel, $tokenNameNew = null) {
        return $this->sendRequest('accesstoken/update', array(
                    'tokenName' => $tokenName,
                    'accessLevel' => $accessLevel,
                    'tokenNameNew' => $tokenNameNew
        ));
    }
891286
public function deleteAccessToken($userId, AccessToken $accessToken)
    {
        $stmt = $this->db->prepare(
            'DELETE FROM
                access_tokens
            WHERE
                user_id = :user_id
            AND
                provider_id = :provider_id
            AND
                access_token = :access_token'
        );

        $stmt->bindValue(':user_id', $userId, PDO::PARAM_STR);
        $stmt->bindValue(':provider_id', $accessToken->getProviderId(), PDO::PARAM_STR);
        $stmt->bindValue(':access_token', $accessToken->getToken(), PDO::PARAM_STR);
        $stmt->execute();
    }
534464
public function handleRefreshToken(AccessToken $previousToken, int $tries): AccessToken
    {
        return $this->client->getConfiguration()->refreshToken($previousToken->getRefreshToken());
    }
552924
public static function createNewRefreshToken(
        int $ttl,
        TokenOwnerInterface $owner = null,
        Client $client = null,
        $scopes = null
    ): RefreshToken {
        return static::createNew($ttl, $owner, $client, $scopes);
    }
5074
private function setRefreshToken($refreshToken)
    {
        if (null !== $refreshToken) {
            // refresh-token = 1*VSCHAR
            // VSCHAR        = %x20-7E
            if (1 !== \preg_match('/^[\x20-\x7E]+$/', $refreshToken)) {
                throw new AccessTokenException('invalid "refresh_token"');
            }
        }
        $this->refreshToken = $refreshToken;
    }
148024
public static UpdateResult update(String accessToken, UpdateCash updateCash) {
		return update(accessToken, JsonUtil.toJSONString(updateCash));
	}
1257944
public function recreateForNewAccessToken($accessToken): self
    {
        AccessTokenValidator::assertIsValid($accessToken);

        return new self($this->client, $this->responseTransformer, $this->apiExceptionTransformer, $accessToken);
    }
757389
public function setAccessToken(\Gpupo\CommonSchema\ORM\Entity\Application\API\OAuth\Client\AccessToken $accessToken = null)
    {
        $this->access_token = $accessToken;

        return $this;
    }
782496
public function refreshToken($refreshToken)
	{
		$this->result = $this->http->get($this->getUrl('sns/oauth2/refresh_token', array(
			'appid'			=>	$this->appid,
			'grant_type'	=>	'refresh_token',
			'refresh_token'	=>	$refreshToken,
		)))->json(true);
		return isset($this->result['errcode']) && 0 == $this->result['errcode'];
	}
742078
public function getRefreshToken($refreshToken)
    {
        $refreshTokenDataMapper = $this->getTokenDataMapper(Entity\RefreshToken::class);

        $token = $refreshTokenDataMapper->findByToken($refreshToken);

        if (! $token instanceof Entity\RefreshToken) {
            return;
        }

        return [
            'refresh_token' => $token->getToken(),
            'client_id'     => $token->getClient()->getUuid(),
            'user_id'       => $token->getUser() ? $token->getUser()->getUuid() : null,
            'expires'       => $token->getExpiryUTCTimestamp(),
            'scope'         => $token->getScopesString(),
        ];
    }
277256
private function getEmails($accessToken)
    {

        $ch = curl_init("https://api.github.com/user/emails?access_token={$accessToken}");
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt(
            $ch,
            CURLOPT_HTTPHEADER,
            ['Content-Type: application/json', 'User-Agent: Thruway-WAMP-App']
        );

        $result = curl_exec($ch);

        return json_decode($result);

    }
725699
public function withAccessToken (AccessToken $token)
    {
        $config = $this->getConfig();
        $this->configureHandlers($config['handler']);
        
        $config['wechat.accessToken'] = $token;
        $config['wechat.developerMode'] = $this->developerMode;
        
        return new static($config);
    }