企业微信安装应用授权 url.

@param string $preAuthCode 预授权码
@param string $redirectUri 回调地址
@param string $state

@return string

@throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
16527
public function getPreAuthorizationUrl(string $preAuthCode = '', string $redirectUri = '', string $state = '')
    {
        $redirectUri || $redirectUri = $this->app->config['redirect_uri_install'];
        $preAuthCode || $preAuthCode = $this->getPreAuthCode()['pre_auth_code'];
        $state || $state = rand();

        $params = [
            'suite_id' => $this->app['config']['suite_id'],
            'redirect_uri' => $redirectUri,
            'pre_auth_code' => $preAuthCode,
            'state' => $state,
        ];

        return 'https://open.work.weixin.qq.com/3rdapp/install?'.http_build_query($params);
    }
710323
public function getAccessToken($redirectUrl = null)
    {
        if (!$code = $this->getCode()) {
            return null;
        }

        $redirectUrl = $redirectUrl ?: $this->urlDetectionHandler->getCurrentUrl();
        // Нам нужно удалить параметры кода и состояния
        $redirectUrl = UrlManipulator::removeParamsFromUrl($redirectUrl, ['state','code']);

        return $this->oAuth2Client->getAccessTokenFromCode($code, $redirectUrl);
    }
974358
protected function getAuthUrl($state)
    {
        // 网页授权登录
        if (!empty($this->scopes)) {
            return $this->getOAuthUrl($state);
        }

        // 第三方网页应用登录（扫码登录）
        return $this->getQrConnectUrl($state);
    }
682867
public void initializeWithCode(String authCode, String redirectUri) throws ProvisioningApiException {
		initialize(null, authCode, redirectUri);
	}
393186
def auth_url(self, scope):
        """"""
        params = {
            'response_type': 'code',
            'client_id': self.__client_id,
            'redirect_uri': self.__redirect_uri,
            'scope': scope
        }

        if self.__state is not None:
            params['state'] = self.__state

        return settings.AUTH_ENDPOINT + '/authorize?' + urllib.urlencode(params)
692613
public static String getOauth2Url(String appId, String redirectUri) throws UnsupportedEncodingException {
		return new StringBuffer().append("https://openauth.alipay.com/oauth2/appToAppAuth.htm?app_id=").append(appId)
				.append("&redirect_uri=").append(URLEncoder.encode(redirectUri, "UTF-8")).toString();
	}
605014
public function getAuthUrl($callbackUrl = null, $state = null, $scope = null)
	{
		$option = array(
			'response_type'		=>	'code',
			'client_id'			=>	$this->appid,
			'redirect_uri'		=>	null === $callbackUrl ? $this->callbackUrl : $callbackUrl,
			'state'				=>	$this->getState($state),
			'scope'				=>	null === $scope ? $this->scope : $scope,
			'display'			=>	$this->display,
		);
		if(null === $this->loginAgentUrl)
		{
			return $this->getUrl('oauth2.0/authorize', $option);
		}
		else
		{
			return $this->loginAgentUrl . '?' . $this->http_build_query($option);
		}
	}
1253613
private String getAuthCode(URI uri) {
		String query = uri.getQuery();
		Map<String, String> map = Splitter.on("&").trimResults().withKeyValueSeparator('=').split(query);
		return map.get("code");
	}
622742
public function getAuthUri($state, $redirectUri, array $scopes = array())
    {
        $params = array(
            'response_type' => 'code',
            'client_id' => $this->credentialsId,
            'scope' => implode(' ', $scopes),
            'redirect_uri' => $redirectUri,
            'state' => $state,
        );
        return $this->authEndpoint . (strpos($this->authEndpoint, '?') === false ? '?' : '&')
            . http_build_query($params, null, '&');
    }
968647
public String prepareUrl(List<Scope> scopes, String redirectUri, String csrfToken) throws InvalidRequestException  {
		
		logger.debug("Enter OAuth2config::prepareUrl");
		if(scopes == null || scopes.isEmpty() || redirectUri.isEmpty() || csrfToken.isEmpty()) {
			logger.error("Invalid request for prepareUrl ");
			throw new InvalidRequestException("Invalid request for prepareUrl");
		}
		try {
			return intuitAuthorizationEndpoint 
					+ "?client_id=" + clientId 
					+ "&response_type=code&scope=" + URLEncoder.encode(buildScopeString(scopes), "UTF-8") 
					+ "&redirect_uri=" + URLEncoder.encode(redirectUri, "UTF-8") 
					+ "&state=" + csrfToken;
		} catch (UnsupportedEncodingException e) {
			logger.error("Exception while preparing url for redirect ", e);
			throw new InvalidRequestException(e.getMessage(), e);
		}
		
	}
917993
public function getLoginUrl(string $redirectUri = '', string $userType = 'admin', string $state = '')
    {
        $redirectUri || $redirectUri = $this->app->config['redirect_uri_single'];
        $state || $state = rand();
        $params = [
            'appid' => $this->app['config']['corp_id'],
            'redirect_uri' => $redirectUri,
            'usertype' => $userType,
            'state' => $state,
        ];

        return 'https://open.work.weixin.qq.com/wwopen/sso/3rd_qrConnect?'.http_build_query($params);
    }
551487
public function getAuthenticationURL($responseType = 'code', $state = null)
    {
        $httpQueryParameters = [
            'client_id' => $this->clientId,
            'response_type' => $responseType,
            'state' => $state,
        ];

        $httpQueryParameters = http_build_query($httpQueryParameters);

        return self::AUTHORIZATION_ENDPOINT . '?' . $httpQueryParameters;
    }
590391
def request_user_auth(code, redirect_uri)
      response = http_client(MXIT_AUTH_TOKEN_URI) do |http, path|

        request = new_post_request(path, {
          "grant_type" => "authorization_code",
          "code" => code,
          "redirect_uri" => redirect_uri
        })

        http.request(request)
      end

      @auth_token = AuthToken.new(handle_response(response))
    end
735673
public function authCodeRequestDeniedRedirectUri()
    {
        $error = new AccessDeniedException();

        return $this->getRedirectUriGenerator()->make($this->getAuthCodeRequestParam('redirect_uri'), [
                        'error' => $error->errorType,
                        'error_description' => $error->getMessage(),
                ]
        );
    }
956572
public function getAuthorizeUrl($request_token, $callback_uri = NULL, $state = NULL) {
    if (empty($callback_uri) && isset($request_token['callback_uri'])) {
      $callback_uri = $request_token['callback_uri'];
    }
    if (empty($state)) {
      $state = md5(mt_rand());
    }
    $params = array();
    if ($this->getConfig()->get('offline_access')) {
      $params += $this->getOfflineAccessParams();
    }

    $query = array(
      'response_type' => 'code',
      'client_id' => $this->getConfig('consumer_key'),
      'redirect_uri' => $callback_uri,
      'scope' => implode($this->getConfig('scope_delimiter'), $this->getScope()),
      'state' => $state,
    ) + $params;
    // authorize
    $url = Url::factory($this->getConfig('base_url'));
    $url->addPath($this->getConfig('authorize_path'));
    $url->setQuery($query);
    return (string)$url;
  }
857227
public function getAccessToken($code, $state = null, $redirectUri = null)
    {
        // No state provided
        // Should probably be
        // handled explicitly
        if (!is_null($state)) {
            //Decode the State
            $state = $this->decodeState($state);

            //CSRF Token
            $csrfToken = $state['csrfToken'];

            //Set the URL State
            $this->urlState = $state['urlState'];

            //Validate CSRF Token
            $this->validateCSRFToken($csrfToken);
        }

        //Fetch Access Token
        $accessToken = $this->getOAuth2Client()->getAccessToken($code, $redirectUri);

        //Make and return the model
        return new AccessToken($accessToken);
    }
1094493
public function getAuthorizationUri($callbackUri, $state)
    {
        $params = array(
            'client_id' => $this->appId,
            'scope' => $this->scope,
            'redirect_uri' => $callbackUri,
            'state' => $state,
            'response_type' => 'code',
        );

        $uri = sprintf('%s%s?%s', $this->endpoint, $this->paths['authorize'], http_build_query($params));

        return $uri;
    }