authenticate

package
v0.0.0-...-2f9bf8d Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2019 License: Apache-2.0 Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent struct {
	Name    string `json:"name"`
	Version int    `json:"version"`
}

Agent is a struct of auth

type Payload

type Payload struct {
	Agent       `json:"agent"`
	UserName    string `json:"username"`
	Password    string `json:"password"`
	ClientToken string `json:"clientToken"`
	RequestUser bool   `json:"requestUser"`
}

Payload is a authenticate request struct

type Response

type Response struct {
	Error        string `json:"error"`
	ErrorMessage string `json:"errorMessage"`
	Cause        string `json:"cause"`

	AccessToken       string `json:"accessToken"`
	ClientToken       string `json:"clientToken"` // identical to the one received
	AvailableProfiles []struct {
		ID     string `json:"ID"` // hexadecimal
		Name   string `json:"name"`
		Legacy bool   `json:"legacy"` // In practice, this field only appears in the response if true. Default to false.
	} `json:"availableProfiles"` // only present if the agent field was received

	SelectedProfile struct {
		ID     string `json:"id"`
		Name   string `json:"name"`
		Legacy bool   `json:"legacy"`
	} `json:"selectedProfile"`
	User struct {
		ID         string `json:"id"` // hexadecimal
		Properties []struct {
			Name  string `json:"name"`
			Value string `json:"value"`
		}
	} `json:"user"`
}

Response is the response from Mojang's auth server

func Authenticate

func Authenticate(user, passwd string) (respData Response, err error)

Authenticate authenticates a user using their password.

func (*Response) ToAuth

func (r *Response) ToAuth() mb.Auth

ToAuth convert Response to github.com/Tnze/gomcbot.Auth

Jump to

Keyboard shortcuts

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