Documentation
¶
Overview ¶
Package auth provides functions related to game authentication.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ClientID string // Client ID for the Azure application
var ErrNoAccount = errors.New("no account found")
var RedirectURI *url.URL // Redirect URI for the OAuth2 authorization code grant
Functions ¶
func AuthCodeURL ¶ added in v1.3.0
AuthCodeURL returns an authorization code URL for the user to navigate to
Used for the OAuth2 authorization code grant
func FetchDeviceCode ¶ added in v1.3.0
func FetchDeviceCode() (deviceCodeResponse, error)
FetchDeviceCode returns a device code for the user to input to authenticate
Used for the OAuth2 device code grant
func ReadFromCache ¶
func ReadFromCache() error
ReadFromCache reads an AuthStore into the global store from the cache file.
This function should be run in order to load the authentication info from the cache. If it is not, the global AuthStore will be blank.
Types ¶
type AuthStore ¶
type AuthStore struct {
MSA msaAuthStore `json:"msa"`
XBL xblAuthStore `json:"xbl"`
XSTS xstsAuthStore `json:"xsts"`
Minecraft minecraftAuthStore `json:"minecraft"`
}
An AuthStore is an authentication store which stores necessary information to log in.
var Store AuthStore
Store is the global authentication store.
func (*AuthStore) WriteToCache ¶
WriteToCache writes the store to the cache file.
type Session ¶
A Session holds the necessary information to start Minecraft authenticated.
func Authenticate ¶
Authenticate authenticates with all necessary endpoints, or cached data if available and returns a Session.
func AuthenticateWithCode ¶
AuthenticateWithCode authenticates with a device code.
This function blocks until the user has been authenticated, or another error has occurred.
func AuthenticateWithRedirect ¶
AuthenticateWithRedirect authenticates using the OAuth2 Code flow.
success is a string to be shown to the user upon successful authentication. fail is shown if an authentication error occurs.
This function blocks until a response has been received on the local authentication server.