rbxauth

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2018 License: MIT Imports: 6 Imported by: 0

README

GoDoc

rbxauth

The rbxauth package is a wrapper for the Roblox authentication API (v2).

Documentation

Overview

The rbxauth package is a wrapper for the Roblox authentication API (v2).

https://auth.roblox.com/docs

Index

Constants

View Source
const DefaultHost = "roblox.com"

DefaultHost defines the default host to use when none is specified.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Host is the domain on which to authenticate. Interpreted as DefaultHost
	// if empty.
	Host string
}

Config configures an authentication action.

func (*Config) Login

func (cfg *Config) Login(username string, password []byte) ([]*http.Cookie, *Step, error)

Login wraps LoginCred, using a username for the credentials.

func (*Config) LoginCred

func (cfg *Config) LoginCred(credType, value string, password []byte) ([]*http.Cookie, *Step, error)

LoginCred attempts to authenticate a user by using the provided credentials.

The credType argument specifies a kind of identifier, which is associated with the account to be authenticated. The value argument is the identifier itself. The following types are known:

"Username"    : The username associated with the account.
"Email"       : The email associated with the account.
"PhoneNumber" : The phone number associated with the account.

The password argument is specified as a slice for future compatibility, where the password may be handled within secured memory.

If multi-step authentication is required, then a Step object is returned. Otherwise, HTTP cookies representing the session are returned.

func (*Config) LoginID

func (cfg *Config) LoginID(userID int64, password []byte) ([]*http.Cookie, *Step, error)

LoginID wraps LoginCred, deriving credentials from the given user ID.

func (*Config) Logout

func (cfg *Config) Logout(cookies []*http.Cookie) error

Logout destroys the session associated with the given cookies, ensuring that the account has been logged out.

type Error

type Error struct {
	Code    int    `json: "code"`
	Message string `json: "message"`
}

Error represents an error return from an API response.

func (Error) Error

func (err Error) Error() string

Error implements the error interface.

type Errors

type Errors []Error

Errors represents a list of errors returned from an API response.

func (Errors) Error

func (errs Errors) Error() string

Error implements the error interface.

type StatusError

type StatusError int

StatusError represents an error derived from the status code of an HTTP response.

func (StatusError) Error

func (err StatusError) Error() string

Error implements the error interface.

type Step

type Step struct {
	// contains filtered or unexported fields
}

Step holds the state of a multi-step verification action.

func (*Step) Resend

func (s *Step) Resend() error

Resend retransmits a two-step verification message.

func (*Step) Verify

func (s *Step) Verify(code string, remember bool) ([]*http.Cookie, error)

Verify receives a verification code to complete authentication. If successful, returns HTTP cookies representing the authenticated session.

The remember argument specifies whether the current device should be remembered for future authentication.

Jump to

Keyboard shortcuts

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