Build url param.

@param string $refreshToken

@return string
168892
public function buildUrlParams($refreshToken)
    {
        $params = 'client_id=' . $this->helper->getWebsiteConfig(
            \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CLIENT_ID
        )
            . '&client_secret=' . $this->helper->getWebsiteConfig(
                \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CLIENT_SECRET_ID
            )
            . '&refresh_token=' . $refreshToken . '&grant_type=refresh_token';

        return $params;
    }
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;
    }
261595
public function readTokenByRefreshValue(string $refreshValue): ?\Limoncello\OAuthServer\Contracts\TokenInterface
    {
        return $this->getIntegration()->getTokenRepository()->readByRefresh(
            $refreshValue,
            $this->getIntegration()->getTokenExpirationPeriod()
        );
    }
13557
public function getRefreshToken($refresh_token)
	{
		// create refresh token
		$token = \Components\Developer\Models\Refreshtoken::oneByToken($refresh_token);

		// make sure we have a token
		if (!$token->get('id'))
		{
			return false;
		}

		// make sure its a published token
		if (!$token->isPublished())
		{
			return false;
		}

		// get the application's client id
		$application = \Components\Developer\Models\Application::oneOrFail($token->get('application_id'));
		$token->set('client_id', $application->get('client_id'));

		// format expires to unix timestamp
		$token->set('expires', with(new Date($token->get('expires')))->toUnix());

		// return token
		return $token->toArray();
	}
832786
public function getPayPalCommunicationUrl($token = null, $userAction = 'continue')
    {
        return $this->getUrl() . '&cmd=_express-checkout&token=' . (string) $token . '&useraction=' . (string) $userAction;
    }
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');
        }
    }
542540
function build($url,$args=[]) {
		$args+=$this->hive['PARAMS'];
		if (is_array($url))
			foreach ($url as &$var) {
				$var=$this->build($var,$args);
				unset($var);
			}
		else {
			$i=0;
			$url=preg_replace_callback('/@(\w+)|(\*)/',
				function($match) use(&$i,$args) {
					if (isset($match[1]) &&
						array_key_exists($match[1],$args))
						return $args[$match[1]];
					if (isset($match[2]) &&
						array_key_exists($match[2],$args)) {
						if (!is_array($args[$match[2]]))
							return $args[$match[2]];
						$i++;
						return $args[$match[2]][$i-1];
					}
					return $match[0];
				},$url);
		}
		return $url;
	}
623194
private function buildUrl($url)
    {
        if (!is_array($url)) {
            if (strpos($url, '://')) {
                return (string) $url;
            }
            return (string) $this->baseUrl->combine($url);
        } elseif (strpos($url[0], '://')) {
            return \GuzzleHttp\uri_template($url[0], $url[1]);
        }

        return (string) $this->baseUrl->combine(
            \GuzzleHttp\uri_template($url[0], $url[1])
        );
    }
69551
protected function buildUrl($url)
    {
        if (strpos($url, '://') || 0 === strpos($url, '/')) {
            return $url;
        } elseif ($url === '') {
            return $url;
        } else {
            return Url::build($url);
        }
    }
1217166
public function setRefreshToken($refreshToken)
    {
        if (is_string($refreshToken)) {
            $refreshToken = new AccessToken($refreshToken, 'refresh_token');
        } elseif (!$refreshToken instanceof AccessToken) {
            throw new \InvalidArgumentException('Invalid refresh token');
        }
        $this->refreshToken = $refreshToken;
    }
395193
public function refreshToken($clientId, $clientSecret, $refreshToken): Token
    {
        $request = new Request('POST', $this->tokenUrl, [
            'Content-Type' => 'application/json',
        ], json_encode([
            'client_id' => $clientId,
            'client_secret' => $clientSecret,
            'refresh_token' => $refreshToken,
            'grant_type' => 'refresh_token',
        ]));

        $response = $this->getClient()->sendRequest($request);
        $responseBody = $response->getBody()->getContents();

        $this->token = $this->denormalizeObject(Token::class, [json_decode($responseBody)], false);

        return $this->token;
    }
633550
public function refreshTokens()
    {
        $headers = array(
            'Content-Type' => 'application/x-www-form-urlencoded'
        );

        $headers = $this->injectUserAgent($headers);

        $res = $this->getHttpClient()->post($this->entrypoint . '/oauth/token', array(
            'client_id' => $this->getClientId(),
            'client_secret' => $this->getClientSecret(),
            'refresh_token' => $this->getRefreshToken()
        ), array(
            'grant_type'=>'refresh_token'
        ), $headers);

        if(!$res) {
            throw new OAuthException('General failure', OAuthException::GENERAL_FAILURE);
        } elseif(isset($res['data']['error'])) {
            $description = 'General failure';
            if(isset($res['data']['error_description'])) {
                $description = $res['data']['error_description'];
            }
            throw new OAuthException(array(
                'message' => $description,
                'http_error' => $res['data']['error']
            ), OAuthException::API_ERROR);
        }

        $this->accessToken = $res['data']['access_token'];
        $this->refreshToken = $res['data']['refresh_token'];
        $this->expiresIn = (int)$res['data']['expires_in'];
        $this->scopes = explode(',', $res['data']['scope']);

        return $res['data'];
    }
1119682
public function refreshToken($refreshToken)
	{
		$response = $this->http->get($this->getUrl('action/openapi/token'), array(
			'client_id'		=>	$this->appid,
			'client_secret'	=>	$this->appSecret,
			'grant_type'	=>	'refresh_token',
			'redirect_uri'	=>	$this->getRedirectUri(),
			'refresh_token'	=>	$refreshToken,
			'dataType'		=>	'json',
		));
		$this->result = $response->json(true);
		if(!isset($this->result['error']))
		{
			return $this->accessToken = $this->result['access_token'];
		}
		else
		{
			throw new ApiException(isset($this->result['error_description']) ? $this->result['error_description'] : '', $response->httpCode());
		}
	}
503415
protected function buildUrl($parsedUrl)
    {
        return (isset($parsedUrl['scheme'])   ?     $parsedUrl["scheme"].'://' : '').
               (isset($parsedUrl['user'])     ?     $parsedUrl["user"].':'     : '').
               (isset($parsedUrl['pass'])     ?     $parsedUrl["pass"].'@'     : '').
               (isset($parsedUrl['host'])     ?     $parsedUrl["host"]         : '').
               (isset($parsedUrl['port'])     ? ':'.$parsedUrl["port"]         : '').
               (isset($parsedUrl['path'])     ?     $parsedUrl["path"]         : '').
               (isset($parsedUrl['query'])    ? '?'.$parsedUrl["query"]        : '').
               (isset($parsedUrl['fragment']) ? '#'.$parsedUrl["fragment"]     : '');
    }
1063185
protected function build_rest_url($url, $params = array()) {
        $base = '';
        if (substr($this->_url, 0, 4) !== 'http') {
            $base .= 'http://';
        }

        $base .= $this->_url;
        if ($this->_port != 80) {
            $base .= ':' . $this->_port;
        }

        $rurl = new \Rapid\URL($base . '/api/' . $url, $params);
        return $rurl->out();
    }
82864
public function getOauthRefreshToken($refresh_token)
    {
        $result = Tools::httpGet(self::API_BASE_URL_PREFIX . self::OAUTH_REFRESH_URL . "appid={$this->appid}&grant_type=refresh_token&refresh_token={$refresh_token}");
        if ($result) {
            $json = json_decode($result, true);
            if (empty($json) || !empty($json['errcode'])) {
                $this->errCode = isset($json['errcode']) ? $json['errcode'] : '505';
                $this->errMsg = isset($json['errmsg']) ? $json['errmsg'] : '无法解析接口返回内容！';
                Tools::log("WechatOauth::getOauthRefreshToken Fail.{$this->errMsg} [{$this->errCode}]", "ERR - {$this->appid}");
                return false;
            }
            return $json;
        }
        return false;
    }
301448
public function getAuthorizerAccessToken($appId, $refreshToken)
    {
        $cacheKey = $this->getAuthorizerAccessTokenCacheKey($appId);
        $credential = $this->cache->get($cacheKey);
        if (!$credential || $credential['expireTime'] - time() < 60) {
            $ret = $this->authorizerToken($appId, $refreshToken);
            if ($ret['code'] !== 1) {
                return $ret;
            } else {
                $credential = [
                    'accessToken' => $ret['authorizer_access_token'],
                    'expireTime' => time() + $ret['expires_in'],
                    'refreshToken' => $ret['authorizer_refresh_token'],
                ];
                $this->cache->set($cacheKey, $credential);
            }
        }

        return $credential['accessToken'];
    }