func (m *Client) Login(username string, password string) (*AuthResponse, error) {
	payload := mojangLogin{
		Agent:       mojangAgent{Name: "Minecraft", Version: 1},
		Username:    username,
		Password:    password,
		RequestUser: true,
	}
	res, err := m.postJSON(context.TODO(), "https://authserver.mojang.com/authenticate", payload)
	if err != nil {
		return nil, err
	}
	if res.StatusCode != http.StatusOK {
		mojangErr := mojangError{}
		if err := parseJSON(res, &mojangErr); err != nil {
			return nil, errors.New("mojang API did response with unexpected status " + res.Status)
		}
		return nil, mojangErr
	}
	authRes := AuthResponse{}
	if err := parseJSON(res, &authRes); err != nil {
		return nil, err
	}
	return &authRes, nil
}
Login is a convenient method that uses username/password credentials
to fetch a token from Mojangs Authentication Server. It then uses (only) that token
to login to minepkg
package mojang
import (
	"bytes"
	"context"
	"encoding/json"
	"errors"
	"io/ioutil"
	"net/http"
)
var (
	ErrorNotFound = errors.New("resource not found")
	ErrorBadRequest = errors.New("bad Request")
)
type Client struct {
	HTTP *http.Client
}
func New() *Client {
	return &Client{
		HTTP: http.DefaultClient,
	}
}
func NewWithClient(client *http.Client) *Client {
	return &Client{
		HTTP: client,
	}
}