Build a URL to create an OAuth dialog.
425313
def get_auth_url(self, app_id, canvas_url, perms=None, **kwargs):
        """"""
        url = "{0}{1}/{2}".format(
            FACEBOOK_WWW_URL, self.version, FACEBOOK_OAUTH_DIALOG_PATH
        )

        args = {"client_id": app_id, "redirect_uri": canvas_url}
        if perms:
            args["scope"] = ",".join(perms)
        args.update(kwargs)
        return url + urlencode(args)
1351755
def get_authorize_url(self, **params):
        """"""
        params = dict(self.params, **params)
        params.update({'client_id': self.client_id, 'response_type': 'code'})
        return self.authorize_url + '?' + urlencode(params)
1169018
def authorize_url(params = nil)
      return nil if self.token.nil?

      params = (params || {}).merge(:oauth_token => self.token)
      build_authorize_url(consumer.authorize_url, params)
    end
647232
def make_url(self, container=None, resource=None, query_items=None):
        """"""
        pth = [self._base_url]
        if container:
            pth.append(container.strip('/'))
        if resource:
            pth.append(resource)
        else:
            pth.append('')
        url = '/'.join(pth)
        if isinstance(query_items, (list, tuple, set)):
            url += RestHttp._list_query_str(query_items)
            query_items = None
        p = requests.PreparedRequest()
        p.prepare_url(url, query_items)
        return p.url
1290474
def authorize_url(self):
        
        url, self.state = self.oauth.authorization_url(
            '%sauthorize' % OAUTH_URL)
        return url
1055934
def oauth_flow(s, oauth_url, username=None, password=None, sandbox=False):
    """"""
    r = s.get(oauth_url)
    if r.status_code >= 300:
        raise RuntimeError(r.text)

    params = urlparse.parse_qs(urlparse.urlparse(r.url).query)

    data = {"un":username,
            "width":2560,
            "height":1440,
            "hasRememberUn":True,
            "startURL":params['startURL'],
            "loginURL":"",
            "loginType":6,
            "useSecure":True,
            "local":"",
            "lt":"OAUTH",
            "qs":"r=https%3A%2F%2Flocalhost%3A8443%2Fsalesforce%2F21",
            "locale":"",
            "oauth_token":"",
            "oauth_callback":"",
            "login":"",
            "serverid":"",
            "display":"popup",
            "username":username,
            "pw":password,
            "Login":""}

    base = "https://login.salesforce.com" if not sandbox else "https://test.salesforce.com"
    r2 = s.post(base, data)
    m = re.search("window.location.href\s*='(.[^']+)'", r2.text)
    assert m is not None, "Couldn't find location.href expression in page %s (Username or password is wrong)" % r2.url

    u3 = "https://" +  urlparse.urlparse(r2.url).hostname + m.group(1)
    r3 = s.get(u3)

    m = re.search("window.location.href\s*='(.[^']+)'", r3.text)

    assert m is not None, "Couldn't find location.href expression in page %s:\n%s" % (r3.url, r3.text)

    return m.group(1)
755474
def construct_url(self):
        """"""
        path = [self.path]
        path.extend([str(x) for x in self.params])

        url = self.client.base_url + '/'.join(x for x in path if x)
        query = self.kwargs.get('query')

        if query:
            # Dict -> List
            if type(query) is dict:
                query = query.items()

            # Remove items with `None` value
            query = [
                (k, v) for (k, v) in query
                if v is not None
            ]

            # Encode query, append to URL
            url += '?' + urlencode(query)

        return url
973830
String toUrl(Auth.UrlCodex urlCodex) {
        return new StringBuilder(authUrl)
                .append(authUrl.contains("?") ? "&" : "?")
                .append("client_id").append("=").append(urlCodex.encode(clientId))
                .append("&").append("response_type").append("=").append("token")
                .append("&").append("scope").append("=").append(scopesToString(urlCodex))
                .toString();
    }
519997
function generate_google_oauth2_url () {
  var access_type = (OPTIONS.access_type) ? OPTIONS.access_type : 'offline';
  var approval_prompt = (OPTIONS.approval_prompt) ? OPTIONS.approval_prompt : 'force';
  var url = oauth2_client.generateAuthUrl({
    access_type: access_type, // set to offline to force a refresh token
    approval_prompt: approval_prompt,
    scope: OPTIONS.scope // can be a space-delimited string or array of scopes
  });
  return url;
}
587481
def request(self, method, url, **kwargs):
        ""
        user_token = kwargs.pop('token', self.token)
        token, _ = self.parse_raw_token(user_token)
        if token is not None:
            params = kwargs.get('params', {})
            params['access_token'] = token
            kwargs['params'] = params
        return super(OAuth2Client, self).request(method, url, **kwargs)
745401
def authentication_url(self):
        """"""
        params = {
            'client_id': self.client_id,
            'response_type': self.type,
            'redirect_uri': self.callback_url
        }
        return AUTHENTICATION_URL + "?" + urlencode(params)
330520
def get_redirect_url(self, **kwargs):
        """"""
        provider_id = kwargs.get('provider', '')
        provider = self.get_provider(provider_id)
        if not provider:
            raise Http404('Unknown OAuth provider.')
        callback = self.get_callback_url(provider)
        params = self.get_additional_parameters(provider)
        return provider.get_redirect_url(self.request, callback=callback, parameters=params)
318744
def construct_url(self):
        """"""
        path = [self.path]
        path.extend(self.params)

        # Build URL
        url = self.client.base_url + '/'.join(
            str(value) for value in path
            if value
        )

        # Append query parameters (if defined)
        query = self.encode_query(self.query)

        if query:
            url += '?' + query

        return url
1304000
function(options){
      var url = options.apiUrl + (options.url ? options.url : '');

      if(options.params) {
        url += (url.indexOf('?') === -1 ? '?' : '&') + this.buildParams(options.params);
      }

      return url;
    }
1163472
def build_url (self):
        """"""
        super(UnknownUrl, self).build_url()
        if self.is_ignored():
            self.add_info(_("%(scheme)s URL ignored.") %
                          {"scheme": self.scheme.capitalize()})
            self.set_result(_("ignored"))
        else:
            self.set_result(_("URL is unrecognized or has invalid syntax"),
                        valid=False)
1113524
def get_authorization_url(self):
        """"""
        return self._format_url(
            OAUTH2_ROOT + 'authorize',
            query = {
                'response_type': 'code',
                'client_id': self.client.get('client_id', ''),
                'redirect_uri': self.client.get('redirect_uri', '')
            })
946765
def setup_oauth_client(self, url=None):
        
        if url and "://" in url:
            server, endpoint = self._deconstruct_url(url)
        else:
            server = self.client.server

        if server not in self._server_cache:
            self._add_client(server)

        if server == self.client.server:
            self.oauth = OAuth1(
                client_key=self.store["client-key"],
                client_secret=self.store["client-secret"],
                resource_owner_key=self.store["oauth-access-token"],
                resource_owner_secret=self.store["oauth-access-secret"],
            )
            return self.oauth
        else:
            return OAuth1(
                client_key=self._server_cache[server].key,
                client_secret=self._server_cache[server].secret,
            )