Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrMissingClientID is returned when the client ID is missing. ErrMissingClientID = errors.New("missing client ID") // ErrMissingClientSecret is returned when the client secret is missing. ErrMissingClientSecret = errors.New("missing client secret") // ErrMissingRedirectURL is returned when the redirect URL is missing. ErrMissingRedirectURL = errors.New("missing redirect URL") )
Functions ¶
This section is empty.
Types ¶
type Auth ¶
type Auth interface { GetOAuth2AuthCodeURL(ctx context.Context, options ...AuthCodeOption) (url string) ExchangeOAuth2AuthCode(ctx context.Context, code string) (token *Token, err error) RefreshOAuth2Token(ctx context.Context, refreshToken *Token) (token *Token, err error) GetOAuth2UserInfo(ctx context.Context, token *Token) (userInfo UserInfo, err error) }
func NewOAuth2Auth ¶
func NewOAuth2Auth(provider OAuth2Provider, authConfig AuthConfig) Auth
type AuthCodeOption ¶
type AuthConfig ¶
type AuthConfig interface { }
func NewAuthConfig ¶
func NewAuthConfig(opts ...AuthOption) AuthConfig
type AuthOption ¶
type AuthOption func(*authConfig)
type OAuth2Provider ¶
type OAuth2Provider interface {
// contains filtered or unexported methods
}
func NewOAuth2Provider ¶
func NewOAuth2Provider(providerType ProviderType, providerConfig ProviderConfig) (OAuth2Provider, error)
type ProviderConfig ¶
type ProviderConfig interface { AuthCodeURL(state string, opts ...AuthCodeOption) string Exchange(ctx context.Context, code string, opts ...AuthCodeOption) (*Token, error) TokenSource(ctx context.Context, token *Token) oauth2.TokenSource Client(ctx context.Context, token *Token) *http.Client // contains filtered or unexported methods }
func NewProviderConfig ¶
func NewProviderConfig(opts ...ProviderOption) (ProviderConfig, error)
type ProviderOption ¶
type ProviderOption func(*providerConfig)
func WithProviderClientID ¶
func WithProviderClientID(clientID string) ProviderOption
func WithProviderClientSecret ¶
func WithProviderClientSecret(clientSecret string) ProviderOption
func WithProviderRedirectURL ¶
func WithProviderRedirectURL(redirectURL string) ProviderOption
func WithProviderScopes ¶
func WithProviderScopes(scopes []string) ProviderOption
type ProviderType ¶
type ProviderType int
const ( GoogleOAuth2ProviderType ProviderType = iota FacebookOAuth2ProviderType LineOAuth2ProviderType GithubOAuth2ProviderType )
func (ProviderType) String ¶
func (t ProviderType) String() string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.