Generate the OAuth authorize url

 @param [Hash] options parameters to be included in the url.
   +:redirect_uri+ is required.
 @return [String] the authorize url
7349
def authorize_url(options)
      raise ArgumentError, ':redirect_uri required' unless options[:redirect_uri]
      params = {
        :client_id => @app_id,
        :response_type => 'code',
        :scope => 'manage_merchant'
      }
      # Faraday doesn't flatten params in this case (Faraday issue #115)
      options = Hash[Utils.flatten_params(options)]
      @oauth_client.authorize_url(params.merge(options))
    end
1215399
public function getAuthoriseUrl()
    {
        // Get the request token
        $token = $this->getToken();
    
        // Prepare request parameters
        $params = array(
            'oauth_token' => $token->oauth_token,
            'oauth_token_secret' => $token->oauth_token_secret,
            'oauth_callback' => $this->callback,
        );
    
        // Build the URL and redirect the user
        $query = '?' . http_build_query($params, '', '&');
        $url = self::WEB_URL . self::AUTHORISE_METHOD . $query;
        return $url;
    }
568239
def token_request(http_method, path, token = nil, request_options = {}, *arguments)
      request_options[:token_request] ||= true
      response = request(http_method, path, token, request_options, *arguments)
      case response.code.to_i

      when (200..299)
        if block_given?
          yield response.body
        else
          # symbolize keys
          # TODO this could be considered unexpected behavior; symbols or not?
          # TODO this also drops subsequent values from multi-valued keys
          CGI.parse(response.body).inject({}) do |h,(k,v)|
            h[k.strip.to_sym] = v.first
            h[k.strip]        = v.first
            h
          end
        end
      when (300..399)
        # this is a redirect
        uri = URI.parse(response['location'])
        response.error! if uri.path == path # careful of those infinite redirects
        self.token_request(http_method, uri.path, token, request_options, arguments)
      when (400..499)
        raise OAuth::Unauthorized, response
      else
        response.error!
      end
    end
10543
def oauth2(self):
        
        if self._url.endswith("/oauth2"):
            url = self._url
        else:
            url = self._url + "/oauth2"
        return _oauth2.oauth2(oauth_url=url,
                              securityHandler=self._securityHandler,
                              proxy_url=self._proxy_url,
                              proxy_port=self._proxy_port)
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;
    }
270184
public URI getAuthorizeBrowserUrl()
    {
        OAuth2AppInfo appInfo = sessionManager.getAppInfo();
        state = PcsUtils.randomString( 30 );

        URI uri = new URIBuilder( URI.create( sessionManager.getAuthorizeUrl() ) )
                .addParameter( OAuth2.CLIENT_ID, appInfo.getAppId() )
                .addParameter( OAuth2.STATE, state )
                .addParameter( OAuth2.RESPONSE_TYPE, "code" )
                .addParameter( OAuth2.REDIRECT_URI, appInfo.getRedirectUrl() )
                .addParameter( OAuth2.SCOPE, sessionManager.getScopeForAuthorization() )
                .build();

        return uri;
    }
450355
def create
      authorize model

      @resource = model.new(creation_params)
      @resource.assign_attributes(**reflections_hash) unless reflections_hash.nil?

      # Customize the create behaviour
      before_create_hook(@resource)

      # TODO: Handle M2M relations in here
      if @resource.save
        after_create_hook(@resource)
        successful_response(:create)
      else
        errorful_resopnse(:create, @resource.errors) do
          redirect_to Rails.application.routes.url_helpers.send(@new_route)
        end
      end
    end
873684
def oauth_header(options = {})
      header_params_str = oauth_parameters.map { |k,v| "#{k}=\"#{escape(v)}\"" }.join(', ')

      realm = "realm=\"#{options[:realm]}\", " if options[:realm]
      "OAuth #{realm}#{header_params_str}"
    end
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)
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)
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);
    }
366099
def authrep(options)
      path = "/transactions/authrep.xml?#{creds_params(options)}"

      options_usage = options.delete :usage
      options_log   = options.delete :log
      extensions    = options.delete :extensions

      options.each_pair do |param, value|
        path += "&#{param}=#{CGI.escape(value.to_s)}"
      end

      options_usage ||= {:hits => 1}
      path += "&#{usage_query_params(options_usage)}"

      if options_log
        log = []
        options_log.each_pair do |key, value|
          escaped_key = CGI.escape "[log][#{key}]"
          log << "#{escaped_key}=#{CGI.escape(value)}"
        end
        path += "&#{log.join('&')}"
      end

      headers = extensions_to_header extensions if extensions
      http_response = @http.get(path, headers: headers)

      case http_response
      when Net::HTTPSuccess,Net::HTTPConflict
        build_authorize_response(http_response.body)
      when Net::HTTPClientError
        build_error_response(http_response.body, AuthorizeResponse)
      else
        raise ServerError.new(http_response)
      end
    end
482174
def authorize_url(self):
        
        redirect_uri = quote(self.redirect_uri, safe=b'')
        url_list = [
            self.OAUTH_BASE_URL,
            'oauth2/authorize?appid=',
            self.app_id,
            '&redirect_uri=',
            redirect_uri,
            '&response_type=code&scope=',
            self.scope
        ]
        if self.state:
            url_list.extend(['&state=', self.state])
        url_list.append('#wechat_redirect')
        return ''.join(url_list)
93385
def authenticate_with_auth_code(authorization_code, redirect_uri)
      response = @oauth_connection.post do |req|
        req.url '/oauth/token'
        req.headers['Content-Type'] = 'application/x-www-form-urlencoded'
        req.body = {:grant_type => 'authorization_code', :client_id => api_key, :client_secret => api_secret, :code => authorization_code, :redirect_uri => redirect_uri}
      end

      @oauth_token = OAuthToken.new(response.body)
      configure_oauth
      @oauth_token
    end
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)
910140
def get_redirect_url(self, state='', **kwargs):
        
        params = {
            'response_type': 'code',
            'client_id': self.client_id,
            'redirect_uri': self.get_callback_url(**kwargs),
            'scope': self.scope or '',
            'state': state,
        }
        
        return '%s?%s' % (self.auth_url, urllib.urlencode(params))
1306830
public HttpUrl authorizeUrl(String scopes, HttpUrl redirectUrl, ByteString state, String team) {
    HttpUrl.Builder builder = baseUrl.newBuilder("/oauth/authorize")
        .addQueryParameter("client_id", clientId)
        .addQueryParameter("scope", scopes)
        .addQueryParameter("redirect_uri", redirectUrl.toString())
        .addQueryParameter("state", state.base64());

    if (team != null) {
      builder.addQueryParameter("team", team);
    }

    return builder.build();
  }