sso

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package sso provides the ability to authenticate characters with the Eve Online SSO API for desktop apps. It implements OAuth 2.0 with the PKCE protocol.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAborted             = errors.New("auth process canceled prematurely")
	ErrTokenError          = errors.New("token error")
	ErrMissingRefreshToken = errors.New("missing refresh token")
)

Functions

This section is empty.

Types

type CacheService

type CacheService interface {
	Get(any) (any, bool)
	Set(any, any, time.Duration)
}

Defines a cache service

type SSOService

type SSOService struct {
	// SSO configuration can be modified before calling any method.
	CallbackPath string
	Port         int
	// contains filtered or unexported fields
}

SSOService is a service for authentication Eve Online characters.

func New

func New(clientID string, client *http.Client, cache CacheService) *SSOService

Returns a new SSO service.

func (*SSOService) Authenticate

func (s *SSOService) Authenticate(ctx context.Context, scopes []string) (*Token, error)

Authenticate an Eve Online character via OAuth 2.0 PKCE and return the new SSO token. Will open a new browser tab on the desktop and run a web server for the OAuth process.

func (*SSOService) RefreshToken

func (s *SSOService) RefreshToken(ctx context.Context, refreshToken string) (*Token, error)

Update given token with new instance from SSO API

type Token

type Token struct {
	AccessToken   string
	CharacterID   int32
	CharacterName string
	ExpiresAt     time.Time
	RefreshToken  string
	Scopes        []string
	TokenType     string
}

OAuth Token for a character in Eve Online.

Jump to

Keyboard shortcuts

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