auth

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthorizationHeader                = "Authorization"
	XAuthorizationHeader               = "X-Authorization"
	ContentType                        = "application/x-www-form-urlencoded"
	UserAgent                          = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36"
	Auth0Url                           = "https://auth0.openai.com"
	LoginUsernameUrl                   = Auth0Url + "/u/login/identifier?state="
	LoginPasswordUrl                   = Auth0Url + "/u/login/password?state="
	ParseUserInfoErrorMessage          = "Failed to parse user login info."
	GetAuthorizedUrlErrorMessage       = "Failed to get authorized url."
	GetStateErrorMessage               = "Failed to get state."
	EmailInvalidErrorMessage           = "Email is not valid."
	EmailOrPasswordInvalidErrorMessage = "Email or password is not correct."
	GetAccessTokenErrorMessage         = "Failed to get access token."
	GetArkoseTokenErrorMessage         = "Failed to get arkose token."
)

Variables

This section is empty.

Functions

func NewHttpClient

func NewHttpClient(proxyUrl string) tls_client.HttpClient

Types

type AccountCookies

type AccountCookies map[string][]*http.Cookie

type Error

type Error struct {
	Location   string
	StatusCode int
	Details    string
}

func NewError

func NewError(location string, statusCode int, details string) *Error

type PostData added in v1.0.1

type PostData struct {
	Blob string `json:"blob"`
}

type ResponseData added in v1.0.1

type ResponseData struct {
	Token string `json:"token"`
}

type Result

type Result struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
	PUID         string `json:"puid"`
	TeamUserID   string `json:"team_uid,omitempty"`
}

type UserID added in v1.0.1

type UserID struct {
	AccountOrdering []string `json:"account_ordering"`
}

type UserLogin

type UserLogin struct {
	Username string
	Password string

	Result    Result
	ArkoseUrl string
	// contains filtered or unexported fields
}

func NewAuthenticator

func NewAuthenticator(emailAddress, password, proxy string, arkoseurl string) *UserLogin

func (*UserLogin) Begin

func (userLogin *UserLogin) Begin() *Error

func (*UserLogin) CheckPassword

func (userLogin *UserLogin) CheckPassword(state string, username string, password string) (string, int, error)

func (*UserLogin) CheckUsername

func (userLogin *UserLogin) CheckUsername(authorizedUrl string, username string) (string, string, int, error)

func (*UserLogin) GetAccessToken

func (userLogin *UserLogin) GetAccessToken() string

func (*UserLogin) GetAccessTokenInternal

func (userLogin *UserLogin) GetAccessTokenInternal(code string) (string, string, int, error)

func (*UserLogin) GetAuthResult

func (userLogin *UserLogin) GetAuthResult() Result

func (*UserLogin) GetAuthorizedUrl

func (userLogin *UserLogin) GetAuthorizedUrl(csrfToken string) (string, int, error)

func (*UserLogin) GetDeviceID added in v1.0.1

func (userLogin *UserLogin) GetDeviceID(authorizedUrl string) string

func (*UserLogin) GetPUID

func (userLogin *UserLogin) GetPUID() (string, *Error)

func (*UserLogin) GetRefreshToken

func (userLogin *UserLogin) GetRefreshToken() string

func (*UserLogin) GetState

func (userLogin *UserLogin) GetState(authorizedUrl string) (int, error)

func (*UserLogin) GetTeamUserID added in v1.0.1

func (userLogin *UserLogin) GetTeamUserID() (string, *Error)

func (*UserLogin) GetToken

func (userLogin *UserLogin) GetToken() (int, string, string, string)

func (*UserLogin) RenewWithCookies

func (userLogin *UserLogin) RenewWithCookies() *Error

func (*UserLogin) ResetCookies

func (userLogin *UserLogin) ResetCookies()

func (*UserLogin) SaveCookies

func (userLogin *UserLogin) SaveCookies() *Error

Jump to

Keyboard shortcuts

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