auth

package
v4.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultHost is the default Host
	DefaultHost string = "clever.com"
	// DefaultBasePath is the default BasePath
	DefaultBasePath string = "/oauth/"
	// DefaultOwnerType is the default owner type
	// - district is the only supported value
	DefaultOwnerType string = "district"
	// ErrTokenNotFound is returned when we can't get the token
	ErrTokenNotFound = errors.New("no token was found")
)

Functions

This section is empty.

Types

type AuthenticationError

type AuthenticationError struct {
	Error       string `json:"error"`
	Description string `json:"error_description"`
}

AuthenticationError represents an auth api call error

type Token

type Token struct {
	ID      string    `json:"id"`
	Created time.Time `json:"created"`
	Owner   struct {
		Type string `json:"type"`
		ID   string `json:"id"`
	} `json:"owner"`
	AccessToken string   `json:"access_token"`
	Scopes      []string `json:"scopes"`
}

Token represents a single token from the auth api

type TokenResponse

type TokenResponse struct {
	Data  []*Token `json:"data"`
	Links []struct {
		Rel string `json:"rel"`
		URI string `json:"uri"`
	} `json:"links"`
}

TokenResponse reprents the token response form an auth api call

func GetDistrictTokens

func GetDistrictTokens(ctx context.Context, clientID, clientSecret, district string) (*TokenResponse, error)

GetDistrictTokens - takes a client id and a client secret and returns bearer tokens

func GetTokens

func GetTokens(ctx context.Context, clientID, clientSecret string) (*TokenResponse, error)

GetTokens - takes a client id and a client secret and returns bearer tokens

func (*TokenResponse) GetTokenByOwner

func (tr *TokenResponse) GetTokenByOwner(id string) (*Token, error)

GetTokenByOwner takes an id and returns the associated token that is in the token response

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL