session

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	REDIRECT_URI = "http://localhost:42069/callback"
	URI          = "http://localhost:42069"
	PORT         = "42069"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Session

type Session struct {
	AccessToken  *tokens.AccessToken
	RefreshToken *tokens.RefreshToken
}

func New

func New(c *config.Config) (*Session, error)

Creates a new session, loading tokens from respective files, and authenticating.

func (*Session) Authenticate

func (s *Session) Authenticate(c *config.Config) error

Authenticate is set to only run checks after the access token expiry period has elapsed. This is for faster runtime, should be perfectly okay unless token files are externally tappered. Checks if the access token is valid. If not, refreshes the access token. If the access token is not valid, reauthenticates s. Updating the token file.

Jump to

Keyboard shortcuts

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