Build the the auth URL so the user can authorize the app.
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))
1010202
def build_authenticated_parameters email, user_identifier, options
      build_request(email, user_identifier, options).tap do |request|
        request['digest'] = digest_request(request)
      end
    end
196733
def auth(self, request):
        
        # create app
        redirect_uris = '%s://%s%s' % (request.scheme, request.get_host(),
                                       reverse('mastodon_callback'))
        us = UserService.objects.get(user=request.user,
                                     name='ServiceMastodon')
        client_id, client_secret = MastodonAPI.create_app(
            client_name="TriggerHappy", api_base_url=us.host,
            redirect_uris=redirect_uris)

        us.client_id = client_id
        us.client_secret = client_secret
        us.save()

        us = UserService.objects.get(user=request.user,
                                     name='ServiceMastodon')
        # get the token by logging in
        mastodon = MastodonAPI(
            client_id=client_id,
            client_secret=client_secret,
            api_base_url=us.host
        )
        token = mastodon.log_in(username=us.username, password=us.password)
        us.token = token
        us.save()
        return self.callback_url(request)
1170777
def build_url_request(self):
        
        params = {}
        headers = {}
        self._authenticator(params, headers)
        self._grant(params)
        return Request(self._endpoint, urlencode(params), headers)
88247
def add_auth_args(parser, config):

    """"""

    parser.add_argument('-p', '--provider', default=config.DEFAULT_PROVIDER)
    parser.add_argument('-u', '--userid', default=config.DEFAULT_USERID)
    parser.add_argument('-k', '--secret_key', default=config.DEFAULT_SECRET_KEY)
    return parser
972443
def _build_url(self):
        """"""
        if self.connection.get("username") and self.connection.get("password"):
            auth = "%s:%s@" % (self.connection["username"],
                               self._encoded_password)
            if self.connection.get("domain"):
                auth = r"%s;%s" % (self.connection["domain"], auth)
        else:
            auth = ""

        # Optional port number
        port = self.connection.get("port")
        port = ":" + port if port else ""

        # Construct mount_url
        self.connection["mount_url"] = "//%s%s%s/%s" % (
            auth, self.connection["url"], port, self.connection["share_name"])
458767
def create(self):
        """"""

        self.before_create()

        puts(green('Creating app context'))
        tdir = os.path.dirname(__file__)

        # Ensure the app context user exists
        user_ensure(self.user, home='/home/' + self.user)
        dir_ensure('/home/%s/.ssh' % self.user)

        t = '/home/%s/.ssh/authorized_keys'
        app_authorized_keys = t % env.user
        ctx_authorized_keys = t % self.user

        # Ensure the app user has the same authorized_keys as the admin user
        if file_exists(app_authorized_keys) and \
           not file_exists(ctx_authorized_keys):
            sudo('cp %s %s' % (app_authorized_keys, ctx_authorized_keys))
            file_attribs(ctx_authorized_keys, mode=755,
                         owner=self.user, group=self.user)

        # Actions to be performed with the app context user
        with settings(user=self.user):
            # Make sure the dot files exist
            # This is mostly necessary for virtualenvwrapper to work properly
            for f in ['bashrc', 'bash_profile', 'profile']:
                lfn = os.path.join(tdir, 'templates', '%s.tmpl' % f)
                contents = file_local_read(lfn) % self.__dict__
                rfn = '/home/%s/.%s' % (self.user, f)
                file_ensure(rfn, owner=self.user, group=self.user)
                file_update(rfn, lambda _: contents)

            # Make sure the sites folder exists
            dir_ensure('/home/%s/sites' % self.user)

            # Make sure the app's required folders exist
            for d in [self.root_dir, self.releases_dir, self.etc_dir,
                      self.log_dir, self.run_dir, self.shared_dir]:
                dir_ensure(d)

            # Create the virtualenv
            run('mkvirtualenv ' + self.name)

        self.after_create()
814432
public function makeAuth()
  {
    if (file_exists('App/Controllers/AuthController.php') || file_exists('templates/auth')) {
      $this->errors[] = 'Authorization has already been carried out or there are custom authorization files in the project!';
    }
    if (!empty($this->errors)) {
      echo array_shift($this->errors);
      exit();
    } else {
      $filename = __DIR__ . '../../App/Bulveyz.php';
      $file = file($filename);
      $file[49] .= file_get_contents(__DIR__ . '../../Auth/templates/Bulveyz.txt');
      file_put_contents($filename, $file);

      $authControllerTemplate = file_get_contents(__DIR__ . '../../Auth/templates/AuthController.txt');
      file_put_contents("App/Controllers/AuthController.php", $authControllerTemplate);

      $authRoutes = file_get_contents(__DIR__ . '../../Auth/templates/authRoutes.txt');
      file_put_contents('./routes/web.php', $authRoutes, FILE_APPEND);

      $headerComponent = file_get_contents(__DIR__ . '../../Auth/templates/header.txt');
      file_put_contents("templates/main/header.tmp", $headerComponent);

      $welcomeTemplate = file_get_contents(__DIR__ . '../../Auth/templates/welcome.txt');
      file_put_contents("templates/welcome.tmp", $welcomeTemplate);

      mkdir('templates/auth');
      copy(__DIR__ . '../../Auth/templates/login.txt', 'templates/auth/login.tmp');
      copy(__DIR__ . '../../Auth/templates/register.txt', 'templates/auth/register.tmp');
      copy(__DIR__ . '../../Auth/templates/reset.txt', 'templates/auth/reset.tmp');
      copy(__DIR__ . '../../Auth/templates/restore.txt', 'templates/auth/restore.tmp');
    }
  }
738239
def auth(self, request):
        
        callback_url = self.callback_url(request)

        request_token = Pocket.get_request_token(consumer_key=self.consumer_key, redirect_uri=callback_url)
        # Save the request token information for later
        request.session['request_token'] = request_token
        # URL to redirect user to, to authorize your app
        auth_url = Pocket.get_auth_url(code=request_token, redirect_uri=callback_url)

        return auth_url
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)
276010
def authenticate(self):
        """"""
        if request.headers.get('Authorization', '').startswith('Negotiate '):
            in_token = base64.b64decode(request.headers['Authorization'][10:])

            try:
                creds = current_app.extensions['gssapi']['creds']
            except KeyError:
                raise RuntimeError('flask-gssapi not configured for this app')

            ctx = gssapi.SecurityContext(creds=creds, usage='accept')

            out_token = ctx.step(in_token)

            if ctx.complete:
                username = ctx._inquire(initiator_name=True).initiator_name
                return str(username), out_token

        return None, None
1203033
def auth(
        cls, consumer_key, redirect_uri='http://example.com/', state=None,
    ):
        '''
        

        '''
        code = cls.get_request_token(consumer_key, redirect_uri, state)

        auth_url = 'https://getpocket.com/auth/authorize?request_token='\
            '%s&redirect_uri=%s' % (code, redirect_uri)
        raw_input(
            'Please open %s in your browser to authorize the app and '
            'press enter:' % auth_url
        )

        return cls.get_access_token(consumer_key, code)
1270291
def authorize_application(
    request,
    redirect_uri = 'https://%s/%s' % (FACEBOOK_APPLICATION_DOMAIN, FACEBOOK_APPLICATION_NAMESPACE),
    permissions = FACEBOOK_APPLICATION_INITIAL_PERMISSIONS
    ):
    
    query = {
        'client_id': FACEBOOK_APPLICATION_ID,
        'redirect_uri': redirect_uri
    }

    if permissions:
        query['scope'] = ', '.join(permissions)

    return render(
        request = request,
        template_name = 'fandjango/authorize_application.html',
        dictionary = {
            'url': 'https://www.facebook.com/dialog/oauth?%s' % urlencode(query)
        },
        status = 401
    )
906865
def AuthorizingClient(domain, auth, user_agent=None):
    """"""
    http_transport = transport.HttpTransport(domain, build_headers(auth, user_agent))
    return client.Client(http_transport)
220959
def construct_auth (self):
        """"""
        if self.auth:
            return
        _user, _password = self.get_user_password()
        if _user is not None and _password is not None:
            self.auth = (_user, _password)
105722
def build_authorize_url(base_url, params)
      uri = URI.parse(base_url.to_s)
      queries = {}
      queries = Hash[URI.decode_www_form(uri.query)] if uri.query
      # TODO doesn't handle array values correctly
      queries.merge!(params) if params
      uri.query = URI.encode_www_form(queries) if !queries.empty?
      uri.to_s
    end
720701
private String buildAuthUrl(String baseAuthUrl, GrantType grantType, OAuth2Parameters parameters) {
		StringBuilder authUrl = new StringBuilder(baseAuthUrl);
		if (grantType == GrantType.AUTHORIZATION_CODE) {
			authUrl.append('&').append("response_type").append('=').append("code");
		} else if (grantType == GrantType.IMPLICIT_GRANT) {
			authUrl.append('&').append("response_type").append('=').append("token");
		}
		for (Iterator<Entry<String, List<String>>> additionalParams = parameters.entrySet().iterator(); additionalParams.hasNext();) {
			Entry<String, List<String>> param = additionalParams.next();
			String name = formEncode(param.getKey());
			for (Iterator<String> values = param.getValue().iterator(); values.hasNext();) {
				authUrl.append('&').append(name);
				String value = values.next();
				if (StringUtils.hasLength(value)) {
					authUrl.append('=').append(formEncode(value));
				}
			}
		}
		return authUrl.toString();		
	}