token

package
v0.0.0-...-347e25e Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("token not found")
)

Functions

This section is empty.

Types

type Repository

type Repository interface {
	GetByUser(ctx context.Context, userID int) (repository.Token, error)
	Save(ctx context.Context, userID int, code, token string) error
}

type Service

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

func NewService

func NewService(todoistClient TodoistClient, tokenRepo Repository, app *config.App) *Service

func (*Service) Authorize

func (s *Service) Authorize(ctx context.Context, userID int, clientID, clientSecret, code, redirectURL string) (string, error)

Authorize retrieves and saves user token to db

func (*Service) GetToken

func (s *Service) GetToken(ctx context.Context, userID int) (string, error)

GetToken returns user's access token stored in db

type TodoistClient

type TodoistClient interface {
	RetrieveAccessToken(ctx context.Context, clientID, clientSecret, code, redirectURL string) (string, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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