Get the authorization URL to redirect the user
182437
def get_authorization_url(self):
        """"""
        url = self._get_oauth_url('authenticate')
        query = {
            'client_id': self._client_id,
            'response_type': 'code',
            'redirect_uri': self.callback
        }
        query_str = self.urlencode(query)

        return url + '?' + query_str
1068548
def get_post_authorization_redirect_url(request, canvas=True):
    

    path = request.get_full_path()

    if canvas:

        if FACEBOOK_APPLICATION_CANVAS_URL:
            path = path.replace(urlparse(FACEBOOK_APPLICATION_CANVAS_URL).path, '')

        redirect_uri = 'https://%(domain)s/%(namespace)s%(path)s' % {
            'domain': FACEBOOK_APPLICATION_DOMAIN,
            'namespace': FACEBOOK_APPLICATION_NAMESPACE,
            'path': path
        }
    else:
        if FANDJANGO_SITE_URL:
            site_url = FANDJANGO_SITE_URL
            path = path.replace(urlparse(site_url).path, '')
        else:
            protocol = "https" if request.is_secure() else "http"
            site_url = "%s://%s" % (protocol, request.get_host())
        redirect_uri = site_url + path

    return redirect_uri
902366
def get_authorize_url(self, **params):
        '''
        
        '''
        params = self.session_obj.sign(self.authorize_url,
                                       self.app_id,
                                       self.app_secret,
                                       **params)
        return self.authorize_url + '?' + params
1332804
public function getAuthorizationUrl($name, $redirectUrl = null, array $extraParameters = [])
    {
        return $this->helper->getAuthorizationUrl($name, $redirectUrl, $extraParameters);
    }
690488
public function authenticationUrl($redirect, $approvalPrompt = 'auto', $scope = null, $state = null)
        {
            $parameters = array(
                'client_id'       => $this->clientId,
                'redirect_uri'    => $redirect,
                'response_type'   => 'code',
                'approval_prompt' => $approvalPrompt,
                'state'           => $state,
            );

            if (! is_null($scope)) {
                $parameters['scope'] = $scope;
            }

            return $this->parseGet(
                $this->authUrl . 'authorize',
                $parameters
            );
        }
834604
def redirect_to_sudo(next_url, sudo_url=None):
    
    if sudo_url is None:
        sudo_url = URL

    sudo_url_parts = list(urlparse(resolve_url(sudo_url)))

    querystring = QueryDict(sudo_url_parts[4], mutable=True)
    querystring[REDIRECT_FIELD_NAME] = next_url
    sudo_url_parts[4] = querystring.urlencode(safe='/')

    return HttpResponseRedirect(urlunparse(sudo_url_parts))
726002
public function getLoginUrl()
    {
        // required params
        $params = array(
            'client_id' => $this->getClientId(),
            'redirect_uri' => $this->getRedirectUri(),
        );
        // optional params
        if ($this->getScope()) {
            $params['scope'] = implode(',', $this->getScope());
        }
        if ($this->getResponceType()) {
            $params['response_type'] = $this->getResponceType();
        }
        if ($this->apiVersion) {
            $params['v'] = $this->apiVersion;
        }
        if ($this->state) {
            $params['state'] = $this->state;
        }

        return 'https://oauth.vk.com/authorize?' . http_build_query($params);
    }
269345
function () {
      if (this.auth_url) {
        return this.auth_url;
      }
      var self = this,
        destination = {
          protocol: 'https',
          host: 'www.box.com',
          pathname: '/api/oauth2/authorize',
          search: querystring.stringify({
            response_type: 'code',
            client_id: self.client_id,
            state: self.csrf,
            redirect_uri: 'http://' + self.host + ':' + self.port + '/authorize?id=' + self.email
          })
        };

      self.auth_url = url.format(destination);
      return self.auth_url;
    }
978199
def get_authorize_url(self, state=None):
        
        payload = {'client_id': self.client_id,
                   'response_type': 'code',
                   'redirect_uri': self.redirect_uri,
                   'scope': self.scope}

        urlparams = urllib.parse.urlencode(payload)

        return "%s?%s" % (self.OAUTH_AUTHORIZE_URL, urlparams)
363772
def get_redirect_url(self, request, callback, parameters=None):
        """"""
        args = self.get_redirect_args(request, callback=callback)
        additional = parameters or {}
        args.update(additional)
        params = urlencode(args)
        return '{0}?{1}'.format(self.authorization_url, params)
832185
def authorize_url(self, redirect_uri, state=None):
        
        redirect_uri = six.moves.urllib.parse.quote(redirect_uri, safe=b'')
        url_list = [
            self.OAUTH_BASE_URL,
            '?appid=',
            self._client.corp_id,
            '&redirect_uri=',
            redirect_uri,
            '&response_type=code&scope=snsapi_base',
        ]
        if state:
            url_list.extend(['&state=', state])
        url_list.append('#wechat_redirect')
        return ''.join(url_list)
962034
def authorize_url(self, state=None):
        '''
        
        '''
        if not self._client_id:
            raise ApiAuthError('No client id.')
        kw = dict(client_id=self._client_id)
        if self._redirect_uri:
            kw['redirect_uri'] = self._redirect_uri
        if self._scope:
            kw['scope'] = self._scope
        if state:
            kw['state'] = state
        return 'https://github.com/login/oauth/authorize?%s' % _encode_params(kw)
32505
def construct_oauth_url(self):
        
        response = self._requester(requests.head, 
                                   "{0}://{1}/".format(self.protocol, self.client.server),
                                   allow_redirects=False
                                  )
        if response.is_redirect:
            server = response.headers['location']
        else:
            server = response.url

        path = "oauth/authorize?oauth_token={token}".format(
            token=self.store["oauth-request-token"]
        )
        return "{server}{path}".format(
            server=server,
            path=path
        )
982915
def retrieve_authorization_code(self, redirect_func=None):
        
        
        request_param = {
            "client_id": self.client_id,
            "redirect_uri": self.redirect_uri,
            }

        if self.scope:
            request_param['scope'] = self.scope

        if self._extra_auth_params:
            request_param.update(self._extra_auth_params)

        r = requests.get(self.auth_uri, params=request_param,
                         allow_redirects=False)
        url = r.headers.get('location') 
        if self.local:
            webbrowser.open_new_tab(url)
            authorization_code = raw_input("Code: ")
            if self.validate_code(authorization_code):
                self.authorization_code = authorization_code
        else:
            return redirect_func(url)
417495
public function getAuthorizationURL()
    {
        $url = Config::inst()->get(self::class, 'AuthorizationUrl');
        $params = [
            'client_id' => $this->client_id,
            'redirect_uri' => $this->getRedirectURL(),
            'response_type' => "code",
            'scope' => $this->scopes,
        ];

        return $url . "?" . http_build_query($params);
    }
1019800
def get_url(request, application, roles, label=None):
    
    args = []
    if label is not None:
        args.append(label)

    # don't use secret_token unless we have to
    if 'is_admin' in roles:
        # Administrators can access anything without secrets
        require_secret = False
    elif 'is_applicant' not in roles:
        # we never give secrets to anybody but the applicant
        require_secret = False
    elif not request.user.is_authenticated:
        # If applicant is not logged in, we redirect them to secret URL
        require_secret = True
    elif request.user != application.applicant:
        # If logged in as different person, we redirect them to secret
        # URL. This could happen if the application was open with a different
        # email address, and the applicant is logged in when accessing it.
        require_secret = True
    else:
        # otherwise redirect them to URL that requires correct login.
        require_secret = False

    # return required url
    if not require_secret:
        url = reverse(
            'kg_application_detail',
            args=[application.pk, application.state] + args)
    else:
        url = reverse(
            'kg_application_unauthenticated',
            args=[application.secret_token, application.state] + args)
    return url
433212
def _authorization_code_flow(self):
        """"""
        options = {
            'scope': getattr(self, 'scope', 'non-expiring'),
            'client_id': self.options.get('client_id'),
            'response_type': 'code',
            'redirect_uri': self._redirect_uri()
        }
        url = '%s%s/connect' % (self.scheme, self.host)
        self._authorize_url = '%s?%s' % (url, urlencode(options))