Generates the authentication URL to which a user should be pointed at in order to start the OAuth2 process.

@param string      $responseType
@param string|null $state

@return string
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;
    }
1214241
public function url($token, $url, $payload = null, $type = 'GET')
    {
        $this->validateUrl($url);

        switch (get_class($token)) {
            case 'Claroline\CoreBundle\Entity\Oauth\FriendRequest': return $this->adminQuery($token, $url, $payload, $type);
            //maybe later, we'll use this method to fetch resources & stuff from an other platform...
            //case 'Claroline\CoreBundle\Entity\Oauth\UserToken': return $this->userQuery($token, $url, $payload, $type);
        }
    }
71114
def get_authorize_url(self, redirect_uri=None, **kw):
        '''
        
        '''
        redirect = redirect_uri if redirect_uri else self.redirect_uri
        if not redirect:
            raise APIError('21305', 'Parameter absent: redirect_uri', 'OAuth2 request')
        response_type = kw.pop('response_type', 'code')
        return '%s%s?%s' % (self.auth_url, 'authorize',
                            _encode_params(client_id=self.client_id,
                                           response_type=response_type,
                                           redirect_uri=redirect, **kw))
244521
@POST
    @Produces(MediaType.APPLICATION_JSON)
    @Consumes(MediaType.APPLICATION_JSON)
    @Description("Authenticates a user principal.")
    @Path("/login")
    public Response login(@Context UriInfo uriInfo, final CredentialsDto creds) {
    	Response response = Response.temporaryRedirect(UriBuilder.fromUri(uriInfo.getBaseUri() + "v2/auth/login").build()).build();
    	return response;
    }
280641
public function getState($type)
    {
        if (!isset($this->states[$type])) {
            return null;
        }

        return $this->states[$type];
    }
1115672
public function restore_recode_legacy_answer($state, $qtype) {
        $restorer = $this->get_qtype_restorer($qtype);
        if ($restorer) {
            return $restorer->recode_legacy_state_answer($state);
        } else {
            return $state->answer;
        }
    }
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);
    }
1346663
public function getAuthUrl($callbackUrl = null, $state = null, $scope = null)
	{
		$option = array(
			'client_id'			=>	$this->appid,
			'redirect_uri'		=>	null === $callbackUrl ? $this->callbackUrl : $callbackUrl,
			'scope'				=>	null === $scope ? $this->scope : $scope,
			'state'				=>	$this->getState($state),
			'allow_signup'		=>	$this->allowSignup,
		);
		if(null === $this->loginAgentUrl)
		{
			return $this->getAuthLoginUrl('login/oauth/authorize', $option);
		}
		else
		{
			return $this->loginAgentUrl . '?' . $this->http_build_query($option);
		}
	}
763136
def getLoginURL(self, redirect_url):
        
        p = Properties()
        p.master = self.master
        clientId = yield p.render(self.clientId)
        oauth_params = {'redirect_uri': self.loginUri,
                        'client_id': clientId, 'response_type': 'code'}
        if redirect_url is not None:
            oauth_params['state'] = urlencode(dict(redirect=redirect_url))
        oauth_params.update(self.authUriAdditionalParams)
        sorted_oauth_params = sorted(oauth_params.items(), key=lambda val: val[0])
        return "%s?%s" % (self.authUri, urlencode(sorted_oauth_params))
331474
public function url($to = null, $scope = 'snsapi_userinfo', $state = 'STATE')
    {
        $to !== null || $to = Url::current();

        $queryStr = [
            'appid'         => $this->getAppId(),
            'redirect_uri'  => $to,
            'response_type' => 'code',
            'scope'         => $scope,
            'state'         => $state,
        ];

        return self::API_URL . '?' . http_build_query($queryStr) . '#wechat_redirect';
    }
853878
public function getOAuth2Url($redirectUrl, $state) {
        return sprintf(self::OAUTH2_LOGIN_CODE_URL, $this->appId, urlencode($redirectUrl), $state);
    }
191649
function getLoginUrl($state) {
        $loginUrl = "https://accounts.google.com/o/oauth2/auth?"
            . "client_id=" . $this->client_id
            . "&redirect_uri=" . $this->redirect
            . "&state=" . $state
            . "&response_type=code"
            . "&scope=email%20profile" 
            . "&include_granted_scopes=true";

        if ( $this->openid_realm ) {
            $loginUrl .= "&openid.realm=" . $this->openid_realm;
        }
        return $loginUrl;
    }
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);
    }
1062208
public static function authorizeUrl($params = null, $opts = null)
    {
        $params = $params ?: [];

        $base = ($opts && array_key_exists('connect_base', $opts)) ? $opts['connect_base'] : Stripe::$connectBase;

        $params['client_id'] = self::_getClientId($params);
        if (!array_key_exists('response_type', $params)) {
            $params['response_type'] = 'code';
        }
        $query = Util\Util::encodeParameters($params);

        return $base . '/oauth/authorize?' . $query;
    }
557314
protected function __getAccessToken($storeState, $code = null, $state = null)
	{
		$this->result = $this->http->post($this->getUrl('oauth2/access_token'), array(
			'client_id'		=>	$this->appid,
			'client_secret'	=>	$this->appSecret,
			'grant_type'	=>	'authorization_code',
			'code'			=>	isset($code) ? $code : (isset($_GET['code']) ? $_GET['code'] : ''),
			'redirect_uri'	=>	$this->getRedirectUri(),
		))->json(true);
		if(isset($this->result['error_code']))
		{
			throw new ApiException($this->result['error'], $this->result['error_code']);
		}
		else
		{
			$this->openid = $this->result['uid'];
			return $this->accessToken = $this->result['access_token'];
		}
	}
177118
public function createAuthUrl($scope) {
    $params = array(
        'response_type=code',
        'redirect_uri=' . urlencode($this->redirectUri),
        'client_id=' . urlencode($this->clientId),
        'scope=' . urlencode($scope),
        'access_type=' . urlencode($this->accessType),
        'approval_prompt=' . urlencode($this->approvalPrompt)
    );

    if (isset($this->state)) {
      $params[] = 'state=' . urlencode($this->state);
    }
    $params = implode('&', $params);
    return self::OAUTH2_AUTH_URL . "?$params";
  }
1367198
public function getAuthorizeUrl($api_settings = '',
                                    $callback_url = 'https://api.vk.com/blank.html', $test_mode = false)
    {
        $parameters = array(
            'client_id' => $this->app_id,
            'scope' => $api_settings,
            'redirect_uri' => $callback_url,
            'response_type' => 'code'
        );

        if ($test_mode)
            $parameters['test_mode'] = 1;

        return $this->createUrl(self::AUTHORIZE_URL, $parameters);
    }