valorant

package module
v0.0.0-...-18a768f Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: MIT Imports: 13 Imported by: 0

README

ValorantAuth

Riot Sign-in in Go

Credits

Big thanks to https://github.com/fyraux/go-rso for the base of this project

Errors

Check file errors.go for all errors

Usage

package valorant

import (
    "fmt"
    "net/url"

	valorant "github.com/iCodeOfTruth/go-rso"
)

func main() {
	valorant.RiotUserAgent = "RiotClient/62.0.1.4852117.4789131 rso-auth (Windows;11;;Professional, x64)" // Set your own user agent

	// Proxy support
	proxyUrl, _ := url.Parse("http://user:pass@ip:port")
	client := valorant.New(proxyUrl) // or New(nil) for no proxy

	data, err := client.Authorize("Username", "Password")
	if err != nil {
		panic(err)
	}

	fmt.Println(data.AccessToken)
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorRiotAuthentication = errors.New("riot_authentication_error")
	ErrorRiotMultifactor    = errors.New("riot_multifactor_error")
	ErrorRiotRateLimit      = errors.New("riot_ratelimit_error")

	ErrorRiotUnknownResponseType = errors.New("riot_unknown_response_type_error")
	ErrorRiotUnknownErrorType    = errors.New("riot_unknown_error_type_error")

	ResponseErrors = map[string]error{
		"auth_failure": ErrorRiotAuthentication,
		"rate_limited": ErrorRiotRateLimit,
	}
)
View Source
var (
	RiotUserAgent = "RiotClient/63.0.9.4909983.4789131 rso-auth (Windows;10;;Professional, x64)"
)

Functions

func GenerateNonce

func GenerateNonce() (string, error)

Types

type Client

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

func New

func New(proxy *url.URL) *Client

func (*Client) Authorize

func (c *Client) Authorize(username, password string) (*UriTokens, error)

func (*Client) SubmitTwoFactor

func (c *Client) SubmitTwoFactor(code string) (*UriTokens, error)

type LoginResponseBody

type LoginResponseBody struct {
	Type     string `json:"type"`
	Error    string `json:"error"`
	Response struct {
		Mode       string `json:"mode"`
		Parameters struct {
			Uri string `json:"uri"`
		} `json:"parameters"`
	} `json:"response"`
	Country string `json:"country"`
}

type UriTokens

type UriTokens struct {
	AccessToken string
	IdToken     string
	ExpiresIn   int
}

Jump to

Keyboard shortcuts

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