xbox

package
v0.0.0-...-f1100e8 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RpAuthXboxLive      = "http://auth.xboxlive.com"             // Xbox Live relying party.
	RpMinecraftServices = "rp://api.minecraftservices.com/"      // Minecraft services relying party.
	RpMinecraftRealms   = "https://pocket.realms.minecraft.net/" // Minecraft Bedrock realms relying party.
)

Variables

View Source
var (
	AuthorizationPendingErr  = &TokenError{Type: "authorization_pending"}
	AuthorizationDeclinedErr = &TokenError{Type: "authorization_declined"}
	BadVerificationCodeErr   = &TokenError{Type: "bad_verification_code"}
	ExpiredTokenErr          = &TokenError{Type: "expired_token"}
)
View Source
var (
	XErrAccountDoesntExist    = &XTokenError{XErr: xErrAccountDoesntExist}
	XErrUnavailableCountry    = &XTokenError{XErr: xErrUnavailableCountry}
	XErrAdultConsentRequired  = &XTokenError{XErr: xErrAdultConsentRequired}
	XErrAdultConsentRequired2 = &XTokenError{XErr: xErrAdultConsentRequired2}
	XErrManagedAccount        = &XTokenError{XErr: xErrManagedAccount}
)

Functions

This section is empty.

Types

type DeviceAuthResponse

type DeviceAuthResponse struct {
	UserCode        string `json:"user_code"`
	DeviceCode      string `json:"device_code"`
	VerificationURI string `json:"verification_uri"`
	ExpiresIn       int    `json:"expires_in"`
	Interval        int    `json:"interval"`
	Message         string `json:"message"`
}

func RequestDeviceAuth

func RequestDeviceAuth() (*DeviceAuthResponse, error)

type TokenError

type TokenError struct {
	Type          string `json:"error"`
	Description   string `json:"error_description"`
	Codes         []int  `json:"error_codes"`
	Timestamp     string `json:"timestamp"`
	TraceID       string `json:"trace_id"`
	CorrelationID string `json:"correlation_id"`
	ErrorURI      string `json:"error_uri"`
}

func (*TokenError) Error

func (e *TokenError) Error() string

func (*TokenError) Is

func (e *TokenError) Is(target error) bool

Is checks whether provided error equals to this error, ignoring auto-generated properties.

type TokenResponse

type TokenResponse struct {
	TokenType    string `json:"token_type"`
	Scope        string `json:"scope"`
	ExpiresIn    int    `json:"expires_in"`
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
	IDToken      string `json:"id_token"`
}

func RefreshToken

func RefreshToken(refreshToken string) (*TokenResponse, error)

func TokenAcquisitionLoop

func TokenAcquisitionLoop(req DeviceAuthResponse) (*TokenResponse, error)

type XDisplayClaims

type XDisplayClaims map[string][]interface{}

type XPropertiesMap

type XPropertiesMap map[string]interface{}

type XTokenError

type XTokenError struct {
	Identity string `json:"Identity"`
	XErr     int64  `json:"XErr"`
	Message  string `json:"Message"`
	Redirect string `json:"Redirect"`
}

func (*XTokenError) Error

func (e *XTokenError) Error() string

func (*XTokenError) Is

func (e *XTokenError) Is(target error) bool

type XTokenRequest

type XTokenRequest struct {
	Properties   XPropertiesMap `json:"Properties"`
	RelyingParty string         `json:"RelyingParty"`
	TokenType    string         `json:"TokenType"`
}

type XTokenResponse

type XTokenResponse struct {
	IssueInstant  time.Time      `json:"IssueInstant"`
	NotAfter      time.Time      `json:"NotAfter"`
	Token         string         `json:"Token"`
	DisplayClaims XDisplayClaims `json:"DisplayClaims"`
}

func AuthXBLUser

func AuthXBLUser(accessToken string) (*XTokenResponse, error)

func GetXSTSToken

func GetXSTSToken(xblToken string) (*XTokenResponse, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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