// GetAuths returns a list of all available auths for an account
// https://www.getlytics.com/developers/rest-api#auth
348567
func (l *Client) GetAuths() ([]*Auth, error) {
	res := ApiResp{}
	data := []*Auth{}

	// make the request
	err := l.Get(authListEndpoint, nil, nil, &res, &data)
	if err != nil {
		return data, err
	}

	return data, nil
}
1303234
func (c *Client) GetTransactions(accessToken, startDate, endDate string) (resp GetTransactionsResponse, err error) {
	options := GetTransactionsOptions{
		StartDate:  startDate,
		EndDate:    endDate,
		AccountIDs: []string{},
		Count:      100,
		Offset:     0,
	}
	return c.GetTransactionsWithOptions(accessToken, options)
}
1196683
func (api *API) PingAuth() ([]string, error) {
	url := createUrl(api, pingAuthPathSegment)
	result := []string{}
	err := api.Client.Get(url, &result, http.StatusOK)
	if err != nil {
		return nil, err
	}

	return result, nil
}
345979
func (c *ApiController) GetAccountOrganizations() {
	fmt.Println("Start get account organizations")

	client := github.NewClient(oauthCfg.Client(oauth2.NoContext, tkn))

	organizations, _, err := client.Organizations.List("", nil)
	if err != nil {
		fmt.Println("error getting organizations")
		fmt.Println(nil)
	}

	c.Data["json"] = organizations
	c.ServeJson()
}
632868
func (c *Users) GetAccount(in *GetAccountInput) (out *GetAccountOutput, err error) {
	body, err := c.call("/users/get_account", in)
	if err != nil {
		return
	}
	defer body.Close()

	err = json.NewDecoder(body).Decode(&out)
	return
}
9295
func (s *AuthServer) GetTokens(opts ...services.MarshalOption) (tokens []services.ProvisionToken, err error) {
	// get node tokens:
	tokens, err = s.Provisioner.GetTokens()
	if err != nil {
		return nil, trace.Wrap(err)
	}
	// get static tokens:
	tkns, err := s.GetStaticTokens()
	if err != nil && !trace.IsNotFound(err) {
		return nil, trace.Wrap(err)
	}
	if err == nil {
		tokens = append(tokens, tkns.GetStaticTokens()...)
	}
	// get user tokens:
	userTokens, err := s.Identity.GetSignupTokens()
	if err != nil {
		return nil, trace.Wrap(err)
	}
	// convert user tokens to machine tokens:
	for _, t := range userTokens {
		roles := teleport.Roles{teleport.RoleSignup}
		tok, err := services.NewProvisionToken(t.Token, roles, t.Expires)
		if err != nil {
			return nil, trace.Wrap(err)
		}
		tokens = append(tokens, tok)
	}
	return tokens, nil
}
1084455
func (s *HmacSha1Signer) GetOAuthParams(request *http.Request, clientConfig *ClientConfig, userConfig *UserConfig, nonce string, timestamp string) (map[string]string, string) {
	oauthParams := map[string]string{
		"oauth_consumer_key":     clientConfig.ConsumerKey,
		"oauth_nonce":            nonce,
		"oauth_signature_method": "HMAC-SHA1",
		"oauth_timestamp":        timestamp,
		"oauth_version":          "1.0",
	}
	tokenKey, tokenSecret := userConfig.GetToken()
	if tokenKey != "" {
		oauthParams["oauth_token"] = tokenKey
	}

	signingParams := request.URL.Query()
	for key, value := range oauthParams {
		signingParams.Set(key, value)
	}

	if request.Body != nil && request.Header.Get("Content-Type") == "application/x-www-form-urlencoded" {
		request.ParseForm()
		for key, values := range request.Form {
			for _, v := range values {
				signingParams.Add(key, v)
			}
		}
		// Calling ParseForm clears out the reader.  It may be
		// necessary to do this in a less destructive way, but for
		// right now, this code reinitializes the body of the request.
		body := strings.NewReader(request.Form.Encode())
		request.Body = ioutil.NopCloser(body)
		request.ContentLength = int64(body.Len())
	}

	signingUrl := fmt.Sprintf("%v://%v%v", request.URL.Scheme, request.URL.Host, request.URL.Path)
	signatureParts := []string{
		request.Method,
		url.QueryEscape(signingUrl),
		url.QueryEscape(sortedQueryString(signingParams))}
	signatureBase := strings.Join(signatureParts, "&")
	oauthParams["oauth_signature"] = s.GetSignature(clientConfig.ConsumerSecret, tokenSecret, signatureBase)
	return oauthParams, signatureBase
}
513058
func (c *FakeOAuthClientAuthorizations) Get(name string, options v1.GetOptions) (result *oauth.OAuthClientAuthorization, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewRootGetAction(oauthclientauthorizationsResource, name), &oauth.OAuthClientAuthorization{})
	if obj == nil {
		return nil, err
	}
	return obj.(*oauth.OAuthClientAuthorization), err
}
331820
func (s *IdentityService) GetUsers() ([]services.User, error) {
	startKey := backend.Key(webPrefix, usersPrefix)
	result, err := s.GetRange(context.TODO(), startKey, backend.RangeEnd(startKey), backend.NoLimit)
	if err != nil {
		return nil, trace.Wrap(err)
	}
	var out []services.User
	for _, item := range result.Items {
		if !bytes.HasSuffix(item.Key, []byte(paramsPrefix)) {
			continue
		}
		u, err := services.GetUserMarshaler().UnmarshalUser(
			item.Value, services.WithResourceID(item.ID), services.WithExpires(item.Expires))
		if err != nil {
			return nil, trace.Wrap(err)
		}
		out = append(out, u)
	}
	return out, nil
}
493215
func (c *AuthorizationService) Get(authzURL string) (acme.Authorization, error) {
	if len(authzURL) == 0 {
		return acme.Authorization{}, errors.New("authorization[get]: empty URL")
	}

	var authz acme.Authorization
	_, err := c.core.postAsGet(authzURL, &authz)
	if err != nil {
		return acme.Authorization{}, err
	}
	return authz, nil
}
1102948
func GetAuthServer(name string) AuthServer {
	authServer, ok := authServers[name]
	if !ok {
		log.Exitf("no AuthServer name %v registered", name)
	}
	return authServer
}
1275304
func getAuthHeaders() map[string]string {
	return map[string]string{
		"X-Auth-Params-Email": fmt.Sprintf("%s@uber.com", strings.ToLower(os.Getenv("USER"))),
	}
}
1137200
func (p *provider) getUserTeams(token string) (sets.String, error) {
	userTeams := sets.NewString()
	err := p.page(p.githubUserTeamURL, token,
		func() interface{} {
			return &[]githubTeam{}
		},
		func(obj interface{}) error {
			for _, team := range *(obj.(*[]githubTeam)) {
				if len(team.Slug) > 0 && len(team.Organization.Login) > 0 {
					userTeams.Insert(strings.ToLower(team.Organization.Login + "/" + team.Slug))
				}
			}
			return nil
		},
	)
	return userTeams, err
}
155566
func (a *api) GetHosts() ([]host.Host, error) {
	client, err := a.connectMaster()
	if err != nil {
		return nil, err
	}

	return client.GetHosts()
}
916676
func (m *OAuth2Method) GetUserCredentials(c context.Context, r *http.Request) (*oauth2.Token, error) {
	chunks := strings.SplitN(r.Header.Get("Authorization"), " ", 2)
	if len(chunks) != 2 || (chunks[0] != "OAuth" && chunks[0] != "Bearer") {
		return nil, errBadAuthHeader
	}
	return &oauth2.Token{
		AccessToken: chunks[1],
		TokenType:   "Bearer",
	}, nil
}
1209415
func (db ErroringDB) GetAuthServiceURL(c context.Context) (string, error) {
	logging.Errorf(c, "%s", db.Error)
	return "", db.Error
}
1070029
func (a *Account) AuthorizedClients() ([]*OAuthClient, error) {
	var clients []*OAuthClient
	err := a.get(a.auth, "/api/v2/users/me/authorized-clients", &clients)
	if err != nil {
		return nil, err
	}

	return clients, nil
}