steamweb

package module
v0.0.0-...-c188e27 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2015 License: MIT Imports: 18 Imported by: 0

README

go-steam-web

Authentication with steam via https://steamcommunity.com website.

Usage

Basic authentication

session := steamweb.NewSession()
response, err := session.Login(&steamweb.NewCredentials("login","password","steamid64"))
//Error checking
if response.LoginComplete {
    //We are logged in :>
}

With steamguard enabled you have to extract steamMachineAuth cookie. Chrome:

  1. Go to https://steamcommunity.com
  2. Click F12 to open developer console
  3. Click Resources and go to cookies/steamcommunity.com
  4. Look for steamMachineAuth and copy value
  5. Supply the value to Credentials.Token credentials.Token="tokengoeshere"

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SteamCommunityUnvavailable = errors.New("Steam community is unavailable")
)

Functions

This section is empty.

Types

type Credentials

type Credentials struct {
	Password          string `url:"password"`
	Username          string `url:"username"`
	TwoFactorCode     string `url:"twofactorcode"`
	EmailAuth         string `url:"emailauth"`
	LoginFriendlyName string `url:"loginfriendlyname"`
	CaptchaGID        int    `url:"captchagid"`
	CaptchaText       string `url:"captcha_text"`
	Token             string `url:"-"`
	SteamID           string `url:"-"`
	EmailSteamID      string `url:"emailsteamid"`
	RSATimeStamp      string `url:"rsatimestamp"`
	RememberLogin     bool   `url:"remember_login"`
	DoNotCache        string `url:"donotcache"`
}

Credentials represents a request parameters for logging in proccess

func NewCredentials

func NewCredentials(username, password, steamid string) Credentials

NewCredentials creates minimum required parameters for logging in proccess

type LoginResponse

type LoginResponse struct {
	Success           bool   `json:"success"`
	Message           string `json:"message,omitempty"`
	RequiresTwoFactor bool   `json:"requires_twofactor"`

	//If requires steamguard
	EmailAuthNeeded bool   `json:"emailauth_needed,omitempty"`
	EmailDomain     string `json:"emaildomain"`
	EmailSteamID    string `json:"emailsteamid"`

	//When logged in
	LoginComplete      bool               `json:"login_complete,omitempty"`
	TransferURL        string             `json:"transfer_url,omitempty"`
	TransferParameters TransferParameters `json:"transfer_parameters,omitempty"`
}

LoginResponse represents response after trying to log in

type Session

type Session struct {
	HTTPClient *http.Client
	// contains filtered or unexported fields
}

Session holding cookies and other needed data for connecting to steam servers

func NewSession

func NewSession() (*Session, error)

NewSession creates new Session The call itself is blocking due to cookies being set up.

func (*Session) GetSessionID

func (sess *Session) GetSessionID() string

GetSessionID gets session id - useful for tradeoffers and other actions

func (*Session) IsLoggedIn

func (sess *Session) IsLoggedIn() bool

func (*Session) Login

func (sess *Session) Login(credentials Credentials) (*LoginResponse, error)

Login logs into steam service with given credentials

func (*Session) NewRequest

func (sess *Session) NewRequest(method string, url string, body io.Reader) *http.Request

NewRequest creates new request with useragent setup to avoid captcha

type TransferParameters

type TransferParameters struct {
	SteamID       string `json:"steamid"`
	Token         string `json:"token"`
	Auth          string `json:"auth"`
	RememberLogin bool   `json:"remember_login"`
	TokenSecure   string `json:"token_secure"`
}

TransferParameters represents Session parameters

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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