oauth2x

package
v0.0.0-...-2668dd0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StravaSource = "strava"
	GithubSource = "github"
)

Variables

This section is empty.

Functions

func InitProvider

func InitProvider(cfg []*ClientConfig)

func Provider

func Provider() map[string]Oauth2x

Types

type ClientConfig

type ClientConfig struct {
	Name         string
	ClientID     string `mapstructure:"client_id"`
	ClientSecret string `mapstructure:"client_secret"`
	Scopes       []string
}

type Oauth2x

type Oauth2x interface {
	Exchange(ctx context.Context, code string) (*oauth2.Token, error)
	GetUser(ctx context.Context, token *oauth2.Token) (*model.User, error)
	Refresh(context.Context, *oauth2.Token) (*oauth2.Token, error)
	Client(ctx context.Context, token *oauth2.Token) *http.Client
}

type Strava

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

func NewStrava

func NewStrava(conf *oauth2.Config) *Strava

func (*Strava) Client

func (s *Strava) Client(ctx context.Context, token *oauth2.Token) *http.Client

func (*Strava) Exchange

func (s *Strava) Exchange(ctx context.Context, code string) (*oauth2.Token, error)

func (*Strava) GetUser

func (s *Strava) GetUser(ctx context.Context, token *oauth2.Token) (*model.User, error)

func (*Strava) Refresh

func (s *Strava) Refresh(ctx context.Context, token *oauth2.Token) (*oauth2.Token, error)

Jump to

Keyboard shortcuts

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