xbox

package
v1.42.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DeviceTypeAndroid = DeviceType{
		DeviceType: "Android",
		ClientID:   "0000000048183522",
		TitleID:    "1739947436",
		Version:    "8.0.0",
		UserAgent:  "XAL Android 2020.07.20200714.000",
	}
	DeviceTypeIOS = DeviceType{
		DeviceType: "iOS",
		ClientID:   "000000004c17c01a",
		TitleID:    "1810924247",
		Version:    "15.6.1",
		UserAgent:  "XAL iOS 2021.11.20211021.000",
	}
	DeviceTypeWindows = DeviceType{
		DeviceType: "Win32",
		ClientID:   "0000000040159362",
		TitleID:    "896928775",
		Version:    "10.0.0",
		UserAgent:  "XAL",
	}
	DeviceTypeNintendo = DeviceType{
		DeviceType: "Nintendo",
		ClientID:   "00000000441cc96b",
		TitleID:    "2047319603",
		Version:    "0.0.0",
		UserAgent:  "XAL",
	}
	DeviceTypePlaystation = DeviceType{
		DeviceType: "Playstation",
		ClientID:   "000000004827c78e",
		TitleID:    "idk",
		Version:    "10.0.0",
		UserAgent:  "XAL",
	}
)

Functions

func RefreshToken

func RefreshToken(t *oauth2.Token, deviceType *DeviceType) (*oauth2.Token, error)

RefreshToken refreshes the oauth2.Token passed and returns a new oauth2.Token. An error is returned if refreshing was not successful.

func RequestLiveTokenWriter

func RequestLiveTokenWriter(ctx context.Context, deviceType *DeviceType, h MSAuthHandler) (*oauth2.Token, error)

RequestLiveTokenWriter does a login request for Microsoft Live Connect using device auth. A login URL will be printed to the io.Writer passed with a user code which the user must use to submit. Once fully authenticated, an oauth2 token is returned which may be used to login to XBOX Live.

Types

type DeviceType

type DeviceType struct {
	DeviceType string
	ClientID   string
	TitleID    string
	Version    string
	UserAgent  string
}

type MSAuthHandler

type MSAuthHandler interface {
	// called with the url the user needs to go to, the code they need to enter
	AuthCode(uri, code string)
	// called when the auth completes, regardless of success, non nil error = Success isnt called
	Finished(err error)
}

type XBLToken

type XBLToken struct {
	AuthorizationToken struct {
		DisplayClaims struct {
			UserInfo []struct {
				GamerTag string `json:"gtg"`
				XUID     string `json:"xid"`
				UserHash string `json:"uhs"`
			} `json:"xui"`
		}
		Token string
	}
}

XBLToken holds info on the authorization token used for authenticating with XBOX Live.

func RequestXBLToken

func RequestXBLToken(ctx context.Context, liveToken *oauth2.Token, relyingParty string, deviceType *DeviceType) (*XBLToken, error)

RequestXBLToken requests an XBOX Live auth token using the passed Live token pair.

func (XBLToken) SetAuthHeader

func (t XBLToken) SetAuthHeader(r *http.Request)

SetAuthHeader returns a string that may be used for the 'Authorization' header used for Minecraft related endpoints that need an XBOX Live authenticated caller.

Jump to

Keyboard shortcuts

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