auth

package
v0.0.0-...-223d31b Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: MIT Imports: 12 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/117.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 GetArkoseToken

func GetArkoseToken(url string) (string, error)

func NewHttpClient

func NewHttpClient(proxyUrl string) tls_client.HttpClient

Types

type AccountCookies

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

type ArkoseToken

type ArkoseToken struct {
	Code    int
	Created int64
	Msg     string
	Token   string
}

type Error

type Error struct {
	Location   string
	StatusCode int
	Details    string
}

func NewError

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

type Result

type Result struct {
	AccessToken string `json:"access_token"`
	PUID        string `json:"puid"`
}

type UserLogin

type UserLogin struct {
	Username string
	Password string

	Result Result
	// contains filtered or unexported fields
}

func NewAuthenticator

func NewAuthenticator(emailAddress, password, proxy 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(state string, username string) (int, error)

func (*UserLogin) GetAccessToken

func (userLogin *UserLogin) GetAccessToken() string

func (*UserLogin) GetAccessTokenInternal

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

func (*UserLogin) GetAuthResult

func (userLogin *UserLogin) GetAuthResult() Result

func (*UserLogin) GetAuthorizedUrl

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

func (*UserLogin) GetPUID

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

func (*UserLogin) GetState

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

func (*UserLogin) GetToken

func (userLogin *UserLogin) GetToken(arkose string) (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