auth

package
v0.23.0-rc6 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2024 License: MIT Imports: 27 Imported by: 72

Documentation

Index

Constants

View Source
const NameApple string = "apple"

NameApple is the unique name of the Apple provider.

View Source
const NameBitbucket = "bitbucket"

NameBitbucket is the unique name of the Bitbucket provider.

View Source
const NameDiscord string = "discord"

NameDiscord is the unique name of the Discord provider.

View Source
const NameFacebook string = "facebook"

NameFacebook is the unique name of the Facebook provider.

View Source
const NameGitea string = "gitea"

NameGitea is the unique name of the Gitea provider.

View Source
const NameGitee string = "gitee"

NameGitee is the unique name of the Gitee provider.

View Source
const NameGithub string = "github"

NameGithub is the unique name of the Github provider.

View Source
const NameGitlab string = "gitlab"

NameGitlab is the unique name of the Gitlab provider.

View Source
const NameGoogle string = "google"

NameGoogle is the unique name of the Google provider.

View Source
const NameInstagram string = "instagram"

NameInstagram is the unique name of the Instagram provider.

View Source
const NameKakao string = "kakao"

NameKakao is the unique name of the Kakao provider.

View Source
const NameLivechat = "livechat"

NameLivechat is the unique name of the Livechat provider.

View Source
const NameMailcow string = "mailcow"

NameMailcow is the unique name of the mailcow provider.

View Source
const NameMicrosoft string = "microsoft"

NameMicrosoft is the unique name of the Microsoft provider.

View Source
const NameMonday = "monday"

NameMonday is the unique name of the Monday provider.

View Source
const NameNotion string = "notion"

NameNotion is the unique name of the Notion provider.

View Source
const NameOIDC string = "oidc"

NameOIDC is the unique name of the OpenID Connect (OIDC) provider.

View Source
const NamePatreon string = "patreon"

NamePatreon is the unique name of the Patreon provider.

View Source
const NamePlanningcenter string = "planningcenter"

NamePlanningcenter is the unique name of the Planningcenter provider.

View Source
const NameSpotify string = "spotify"

NameSpotify is the unique name of the Spotify provider.

View Source
const NameStrava string = "strava"

NameStrava is the unique name of the Strava provider.

View Source
const NameTwitch string = "twitch"

NameTwitch is the unique name of the Twitch provider.

View Source
const NameTwitter string = "twitter"

NameTwitter is the unique name of the Twitter provider.

View Source
const NameVK string = "vk"

NameVK is the unique name of the VK provider.

View Source
const NameYandex string = "yandex"

NameYandex is the unique name of the Yandex provider.

Variables

View Source
var Providers = map[string]ProviderFactoryFunc{}

Providers defines a map with all of the available OAuth2 providers.

To register a new provider append a new entry in the map.

Functions

This section is empty.

Types

type Apple added in v0.14.0

type Apple struct {
	BaseProvider
	// contains filtered or unexported fields
}

Apple allows authentication via Apple OAuth2.

func NewAppleProvider added in v0.14.0

func NewAppleProvider() *Apple

NewAppleProvider creates a new Apple provider instance with some defaults.

func (*Apple) FetchAuthUser added in v0.14.0

func (p *Apple) FetchAuthUser(token *oauth2.Token) (*AuthUser, error)

FetchAuthUser returns an AuthUser instance based on the provided token.

API reference: https://developer.apple.com/documentation/sign_in_with_apple/tokenresponse.

func (*Apple) FetchRawUserInfo

func (p *Apple) FetchRawUserInfo(token *oauth2.Token) ([]byte, error)

FetchRawUserInfo implements Provider.FetchRawUserInfo interface.

Apple doesn't have a UserInfo endpoint and claims about users are instead included in the "id_token" (https://openid.net/specs/openid-connect-core-1_0.html#id_tokenExample)

type AuthUser

type AuthUser struct {
	Expiry       types.DateTime `json:"expiry"`
	RawUser      map[string]any `json:"rawUser"`
	Id           string         `json:"id"`
	Name         string         `json:"name"`
	Username     string         `json:"username"`
	Email        string         `json:"email"`
	AvatarURL    string         `json:"avatarURL"`
	AccessToken  string         `json:"accessToken"`
	RefreshToken string         `json:"refreshToken"`

	// @todo
	// deprecated: use AvatarURL instead
	// AvatarUrl will be removed after dropping v0.22 support
	AvatarUrl string `json:"avatarUrl"`
}

AuthUser defines a standardized OAuth2 user data structure.

func (AuthUser) MarshalJSON

func (au AuthUser) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

@todo remove after dropping v0.22 support

type BaseProvider

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

BaseProvider defines common fields and methods used by OAuth2 client providers.

func (*BaseProvider) AuthURL

func (p *BaseProvider) AuthURL() string

AuthURL implements Provider.AuthURL() interface method.

func (*BaseProvider) BuildAuthURL

func (p *BaseProvider) BuildAuthURL(state string, opts ...oauth2.AuthCodeOption) string

BuildAuthURL implements Provider.BuildAuthURL() interface method.

func (*BaseProvider) Client

func (p *BaseProvider) Client(token *oauth2.Token) *http.Client

Client implements Provider.Client() interface method.

func (*BaseProvider) ClientId

func (p *BaseProvider) ClientId() string

ClientId implements Provider.ClientId() interface method.

func (*BaseProvider) ClientSecret

func (p *BaseProvider) ClientSecret() string

ClientSecret implements Provider.ClientSecret() interface method.

func (*BaseProvider) Context

func (p *BaseProvider) Context() context.Context

Context implements Provider.Context() interface method.

func (*BaseProvider) DisplayName

func (p *BaseProvider) DisplayName() string

DisplayName implements Provider.DisplayName() interface method.

func (*BaseProvider) Extra

func (p *BaseProvider) Extra() map[string]any

Extra implements Provider.Extra() interface method.

func (*BaseProvider) FetchRawUserInfo

func (p *BaseProvider) FetchRawUserInfo(token *oauth2.Token) ([]byte, error)

FetchRawUserInfo implements Provider.FetchRawUserInfo() interface method.

func (*BaseProvider) FetchToken

func (p *BaseProvider) FetchToken(code string, opts ...oauth2.AuthCodeOption) (*oauth2.Token, error)

FetchToken implements Provider.FetchToken() interface method.

func (*BaseProvider) PKCE

func (p *BaseProvider) PKCE() bool

PKCE implements Provider.PKCE() interface method.

func (*BaseProvider) RedirectURL

func (p *BaseProvider) RedirectURL() string

RedirectURL implements Provider.RedirectURL() interface method.

func (*BaseProvider) Scopes

func (p *BaseProvider) Scopes() []string

Scopes implements Provider.Scopes() interface method.

func (*BaseProvider) SetAuthURL

func (p *BaseProvider) SetAuthURL(url string)

SetAuthURL implements Provider.SetAuthURL() interface method.

func (*BaseProvider) SetClientId

func (p *BaseProvider) SetClientId(clientId string)

SetClientId implements Provider.SetClientId() interface method.

func (*BaseProvider) SetClientSecret

func (p *BaseProvider) SetClientSecret(secret string)

SetClientSecret implements Provider.SetClientSecret() interface method.

func (*BaseProvider) SetContext

func (p *BaseProvider) SetContext(ctx context.Context)

SetContext implements Provider.SetContext() interface method.

func (*BaseProvider) SetDisplayName

func (p *BaseProvider) SetDisplayName(displayName string)

SetDisplayName implements Provider.SetDisplayName() interface method.

func (*BaseProvider) SetExtra

func (p *BaseProvider) SetExtra(data map[string]any)

SetExtra implements Provider.SetExtra() interface method.

func (*BaseProvider) SetPKCE

func (p *BaseProvider) SetPKCE(enable bool)

SetPKCE implements Provider.SetPKCE() interface method.

func (*BaseProvider) SetRedirectURL

func (p *BaseProvider) SetRedirectURL(url string)

SetRedirectURL implements Provider.SetRedirectURL() interface method.

func (*BaseProvider) SetScopes

func (p *BaseProvider) SetScopes(scopes []string)

SetScopes implements Provider.SetScopes() interface method.

func (*BaseProvider) SetTokenURL

func (p *BaseProvider) SetTokenURL(url string)

SetTokenURL implements Provider.SetTokenURL() interface method.

func (*BaseProvider) SetUserInfoURL

func (p *BaseProvider) SetUserInfoURL(url string)

SetUserInfoURL implements Provider.SetUserInfoURL() interface method.

func (*BaseProvider) TokenURL

func (p *BaseProvider) TokenURL() string

TokenURL implements Provider.TokenURL() interface method.

func (*BaseProvider) UserInfoURL

func (p *BaseProvider) UserInfoURL() string

UserInfoURL implements Provider.UserInfoURL() interface method.

type Bitbucket added in v0.21.0

type Bitbucket struct {
	BaseProvider
}

Bitbucket is an auth provider for Bitbucket.

func NewBitbucketProvider added in v0.21.0

func NewBitbucketProvider() *Bitbucket

NewBitbucketProvider creates a new Bitbucket provider instance with some defaults.

func (*Bitbucket) FetchAuthUser added in v0.21.0

func (p *Bitbucket) FetchAuthUser(token *oauth2.Token) (*AuthUser, error)

FetchAuthUser returns an AuthUser instance based on the Bitbucket's user API.

API reference: https://developer.atlassian.com/cloud/bitbucket/rest/api-group-users/#api-user-get

type Discord added in v0.6.0

type Discord struct {
	BaseProvider
}

Discord allows authentication via Discord OAuth2.

func NewDiscordProvider added in v0.6.0

func NewDiscordProvider() *Discord

NewDiscordProvider creates a new Discord provider instance with some defaults.

func (*Discord) FetchAuthUser added in v0.6.0

func (p *Discord) FetchAuthUser(token *oauth2.Token) (*AuthUser, error)

FetchAuthUser returns an AuthUser instance from Discord's user api.

API reference: https://discord.com/developers/docs/resources/user#user-object

type Facebook

type Facebook struct {
	BaseProvider
}

Facebook allows authentication via Facebook OAuth2.

func NewFacebookProvider

func NewFacebookProvider() *Facebook

NewFacebookProvider creates new Facebook provider instance with some defaults.

func (*Facebook) FetchAuthUser

func (p *Facebook) FetchAuthUser(token *oauth2.Token) (*AuthUser, error)

FetchAuthUser returns an AuthUser instance based on the Facebook's user api.

API reference: https://developers.facebook.com/docs/graph-api/reference/user/

type Gitea added in v0.12.0

type Gitea struct {
	BaseProvider
}

Gitea allows authentication via Gitea OAuth2.

func NewGiteaProvider added in v0.12.0

func NewGiteaProvider() *Gitea

NewGiteaProvider creates new Gitea provider instance with some defaults.

func (*Gitea) FetchAuthUser added in v0.12.0

func (p *Gitea) FetchAuthUser(token *oauth2.Token) (*AuthUser, error)

FetchAuthUser returns an AuthUser instance based on Gitea's user api.

API reference: https://try.gitea.io/api/swagger#/user/userGetCurrent

type Gitee added in v0.11.0

type Gitee struct {
	BaseProvider
}

Gitee allows authentication via Gitee OAuth2.

func NewGiteeProvider added in v0.11.0

func NewGiteeProvider() *Gitee

NewGiteeProvider creates new Gitee provider instance with some defaults.

func (*Gitee) FetchAuthUser added in v0.11.0

func (p *Gitee) FetchAuthUser(token *oauth2.Token) (*AuthUser, error)

FetchAuthUser returns an AuthUser instance based the Gitee's user api.

API reference: https://gitee.com/api/v5/swagger#/getV5User

type Github

type Github struct {
	BaseProvider
}

Github allows authentication via Github OAuth2.

func NewGithubProvider

func NewGithubProvider() *Github

NewGithubProvider creates new Github provider instance with some defaults.

func (*Github) FetchAuthUser

func (p *Github) FetchAuthUser(token *oauth2.Token) (*AuthUser, error)

FetchAuthUser returns an AuthUser instance based the Github's user api.

API reference: https://docs.github.com/en/rest/reference/users#get-the-authenticated-user

type Gitlab

type Gitlab struct {
	BaseProvider
}

Gitlab allows authentication via Gitlab OAuth2.

func NewGitlabProvider

func NewGitlabProvider() *Gitlab

NewGitlabProvider creates new Gitlab provider instance with some defaults.

func (*Gitlab) FetchAuthUser

func (p *Gitlab) FetchAuthUser(token *oauth2.Token) (*AuthUser, error)

FetchAuthUser returns an AuthUser instance based the Gitlab's user api.

API reference: https://docs.gitlab.com/ee/api/users.html#for-admin

type Google

type Google struct {
	BaseProvider
}

Google allows authentication via Google OAuth2.

func NewGoogleProvider

func NewGoogleProvider() *Google

NewGoogleProvider creates new Google provider instance with some defaults.

func (*Google) FetchAuthUser

func (p *Google) FetchAuthUser(token *oauth2.Token) (*AuthUser, error)

FetchAuthUser returns an AuthUser instance based the Google's user api.

type Instagram added in v0.17.0

type Instagram struct {
	BaseProvider
}

Instagram allows authentication via Instagram OAuth2.

func NewInstagramProvider added in v0.17.0

func NewInstagramProvider() *Instagram

NewInstagramProvider creates new Instagram provider instance with some defaults.

func (*Instagram) FetchAuthUser added in v0.17.0

func (p *Instagram) FetchAuthUser(token *oauth2.Token) (*AuthUser, error)

FetchAuthUser returns an AuthUser instance based on the Instagram's user api.

API reference: https://developers.facebook.com/docs/instagram-basic-display-api/reference/user#fields

type Kakao added in v0.8.0

type Kakao struct {
	BaseProvider
}

Kakao allows authentication via Kakao OAuth2.

func NewKakaoProvider added in v0.8.0

func NewKakaoProvider() *Kakao

NewKakaoProvider creates a new Kakao provider instance with some defaults.

func (*Kakao) FetchAuthUser added in v0.8.0

func (p *Kakao) FetchAuthUser(token *oauth2.Token) (*AuthUser, error)

FetchAuthUser returns an AuthUser instance based on the Kakao's user api.

API reference: https://developers.kakao.com/docs/latest/en/kakaologin/rest-api#req-user-info-response

type Livechat added in v0.12.0

type Livechat struct {
	BaseProvider
}

Livechat allows authentication via Livechat OAuth2.

func NewLivechatProvider added in v0.12.0

func NewLivechatProvider() *Livechat

NewLivechatProvider creates new Livechat provider instance with some defaults.

func (*Livechat) FetchAuthUser added in v0.12.0

func (p *Livechat) FetchAuthUser(token *oauth2.Token) (*AuthUser, error)

FetchAuthUser returns an AuthUser based on the Livechat accounts API.

API reference: https://developers.livechat.com/docs/authorization

type Mailcow added in v0.19.0

type Mailcow struct {
	BaseProvider
}

Mailcow allows authentication via mailcow OAuth2.

func NewMailcowProvider added in v0.19.0

func NewMailcowProvider() *Mailcow

NewMailcowProvider creates a new mailcow provider instance with some defaults.

func (*Mailcow) FetchAuthUser added in v0.19.0

func (p *Mailcow) FetchAuthUser(token *oauth2.Token) (*AuthUser, error)

FetchAuthUser returns an AuthUser instance based on mailcow's user api.

API reference: https://github.com/mailcow/mailcow-dockerized/blob/master/data/web/oauth/profile.php

type Microsoft added in v0.8.0

type Microsoft struct {
	BaseProvider
}

Microsoft allows authentication via AzureADEndpoint OAuth2.

func NewMicrosoftProvider added in v0.8.0

func NewMicrosoftProvider() *Microsoft

NewMicrosoftProvider creates new Microsoft AD provider instance with some defaults.

func (*Microsoft) FetchAuthUser added in v0.8.0

func (p *Microsoft) FetchAuthUser(token *oauth2.Token) (*AuthUser, error)

FetchAuthUser returns an AuthUser instance based on the Microsoft's user api.

API reference: https://learn.microsoft.com/en-us/azure/active-directory/develop/userinfo Graph explorer: https://developer.microsoft.com/en-us/graph/graph-explorer

type Monday

type Monday struct {
	BaseProvider
}

Monday is an auth provider for monday.com.

func NewMondayProvider

func NewMondayProvider() *Monday

NewMondayProvider creates a new Monday provider instance with some defaults.

func (*Monday) FetchAuthUser

func (p *Monday) FetchAuthUser(token *oauth2.Token) (*AuthUser, error)

FetchAuthUser returns an AuthUser instance based on the Monday's user api.

API reference: https://developer.monday.com/api-reference/reference/me

func (*Monday) FetchRawUserData

func (p *Monday) FetchRawUserData(token *oauth2.Token) ([]byte, error)

FetchRawUserData implements Provider.FetchRawUserData interface.

monday.com doesn't have a UserInfo endpoint and information on the user is retrieved using their GraphQL API (https://developer.monday.com/api-reference/reference/me#queries)

type Notion

type Notion struct {
	BaseProvider
}

Notion allows authentication via Notion OAuth2.

func NewNotionProvider

func NewNotionProvider() *Notion

NewNotionProvider creates new Notion provider instance with some defaults.

func (*Notion) FetchAuthUser

func (p *Notion) FetchAuthUser(token *oauth2.Token) (*AuthUser, error)

FetchAuthUser returns an AuthUser instance based on the Notion's User api. API reference: https://developers.notion.com/reference/get-self

func (*Notion) FetchRawUserInfo

func (p *Notion) FetchRawUserInfo(token *oauth2.Token) ([]byte, error)

FetchRawUserInfo implements Provider.FetchRawUserInfo interface method.

This differ from BaseProvider because Notion requires a version header for all requests (https://developers.notion.com/reference/versioning).

type OIDC added in v0.13.0

type OIDC struct {
	BaseProvider
}

OIDC allows authentication via OpenID Connect (OIDC) OAuth2 provider.

If specified the user data is fetched from the userInfoURL. Otherwise - from the id_token payload.

The provider support the following Extra config options:

  • "jwksURL" - url to the keys to validate the id_token signature (optional and used only when reading the user data from the id_token)
  • "issuers" - list of valid issuers for the iss id_token claim (optioanl and used only when reading the user data from the id_token)

func NewOIDCProvider added in v0.13.0

func NewOIDCProvider() *OIDC

NewOIDCProvider creates new OpenID Connect (OIDC) provider instance with some defaults.

func (*OIDC) FetchAuthUser added in v0.13.0

func (p *OIDC) FetchAuthUser(token *oauth2.Token) (*AuthUser, error)

FetchAuthUser returns an AuthUser instance based the provider's user api.

API reference: https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims

func (*OIDC) FetchRawUserInfo

func (p *OIDC) FetchRawUserInfo(token *oauth2.Token) ([]byte, error)

FetchRawUserInfo implements Provider.FetchRawUserInfo interface method.

It either fetch the data from p.userInfoURL, or if not set - returns the id_token claims.

type Patreon added in v0.19.0

type Patreon struct {
	BaseProvider
}

Patreon allows authentication via Patreon OAuth2.

func NewPatreonProvider added in v0.19.0

func NewPatreonProvider() *Patreon

NewPatreonProvider creates new Patreon provider instance with some defaults.

func (*Patreon) FetchAuthUser added in v0.19.0

func (p *Patreon) FetchAuthUser(token *oauth2.Token) (*AuthUser, error)

FetchAuthUser returns an AuthUser instance based on the Patreons's identity api.

API reference: https://docs.patreon.com/#get-api-oauth2-v2-identity https://docs.patreon.com/#user-v2

type Planningcenter added in v0.22.0

type Planningcenter struct {
	BaseProvider
}

Planningcenter allows authentication via Planningcenter OAuth2.

func NewPlanningcenterProvider added in v0.22.0

func NewPlanningcenterProvider() *Planningcenter

NewPlanningcenterProvider creates a new Planningcenter provider instance with some defaults.

func (*Planningcenter) FetchAuthUser added in v0.22.0

func (p *Planningcenter) FetchAuthUser(token *oauth2.Token) (*AuthUser, error)

FetchAuthUser returns an AuthUser instance based on the Planningcenter's user api.

API reference: https://developer.planning.center/docs/#/overview/authentication

type Provider

type Provider interface {
	// Context returns the context associated with the provider (if any).
	Context() context.Context

	// SetContext assigns the specified context to the current provider.
	SetContext(ctx context.Context)

	// PKCE indicates whether the provider can use the PKCE flow.
	PKCE() bool

	// SetPKCE toggles the state whether the provider can use the PKCE flow or not.
	SetPKCE(enable bool)

	// DisplayName usually returns provider name as it is officially written
	// and it could be used directly in the UI.
	DisplayName() string

	// SetDisplayName sets the provider's display name.
	SetDisplayName(displayName string)

	// Scopes returns the provider access permissions that will be requested.
	Scopes() []string

	// SetScopes sets the provider access permissions that will be requested later.
	SetScopes(scopes []string)

	// ClientId returns the provider client's app ID.
	ClientId() string

	// SetClientId sets the provider client's ID.
	SetClientId(clientId string)

	// ClientSecret returns the provider client's app secret.
	ClientSecret() string

	// SetClientSecret sets the provider client's app secret.
	SetClientSecret(secret string)

	// RedirectURL returns the end address to redirect the user
	// going through the OAuth flow.
	RedirectURL() string

	// SetRedirectURL sets the provider's RedirectURL.
	SetRedirectURL(url string)

	// AuthURL returns the provider's authorization service url.
	AuthURL() string

	// SetAuthURL sets the provider's AuthURL.
	SetAuthURL(url string)

	// TokenURL returns the provider's token exchange service url.
	TokenURL() string

	// SetTokenURL sets the provider's TokenURL.
	SetTokenURL(url string)

	// UserInfoURL returns the provider's user info api url.
	UserInfoURL() string

	// SetUserInfoURL sets the provider's UserInfoURL.
	SetUserInfoURL(url string)

	// Extra returns a shallow copy of any custom config data
	// that the provider may be need.
	Extra() map[string]any

	// SetExtra updates the provider's custom config data.
	SetExtra(data map[string]any)

	// Client returns an http client using the provided token.
	Client(token *oauth2.Token) *http.Client

	// BuildAuthURL returns a URL to the provider's consent page
	// that asks for permissions for the required scopes explicitly.
	BuildAuthURL(state string, opts ...oauth2.AuthCodeOption) string

	// FetchToken converts an authorization code to token.
	FetchToken(code string, opts ...oauth2.AuthCodeOption) (*oauth2.Token, error)

	// FetchRawUserInfo requests and marshalizes into `result` the
	// the OAuth user api response.
	FetchRawUserInfo(token *oauth2.Token) ([]byte, error)

	// FetchAuthUser is similar to FetchRawUserInfo, but normalizes and
	// marshalizes the user api response into a standardized AuthUser struct.
	FetchAuthUser(token *oauth2.Token) (user *AuthUser, err error)
}

Provider defines a common interface for an OAuth2 client.

func NewProviderByName

func NewProviderByName(name string) (Provider, error)

NewProviderByName returns a new preconfigured provider instance by its name identifier.

type ProviderFactoryFunc

type ProviderFactoryFunc func() Provider

ProviderFactoryFunc defines a function for initializing a new OAuth2 provider.

type Spotify added in v0.8.0

type Spotify struct {
	BaseProvider
}

Spotify allows authentication via Spotify OAuth2.

func NewSpotifyProvider added in v0.8.0

func NewSpotifyProvider() *Spotify

NewSpotifyProvider creates a new Spotify provider instance with some defaults.

func (*Spotify) FetchAuthUser added in v0.8.0

func (p *Spotify) FetchAuthUser(token *oauth2.Token) (*AuthUser, error)

FetchAuthUser returns an AuthUser instance based on the Spotify's user api.

API reference: https://developer.spotify.com/documentation/web-api/reference/#/operations/get-current-users-profile

type Strava added in v0.11.0

type Strava struct {
	BaseProvider
}

Strava allows authentication via Strava OAuth2.

func NewStravaProvider added in v0.11.0

func NewStravaProvider() *Strava

NewStravaProvider creates new Strava provider instance with some defaults.

func (*Strava) FetchAuthUser added in v0.11.0

func (p *Strava) FetchAuthUser(token *oauth2.Token) (*AuthUser, error)

FetchAuthUser returns an AuthUser instance based on the Strava's user api.

API reference: https://developers.strava.com/docs/authentication/

type Twitch added in v0.8.0

type Twitch struct {
	BaseProvider
}

Twitch allows authentication via Twitch OAuth2.

func NewTwitchProvider added in v0.8.0

func NewTwitchProvider() *Twitch

NewTwitchProvider creates new Twitch provider instance with some defaults.

func (*Twitch) FetchAuthUser added in v0.8.0

func (p *Twitch) FetchAuthUser(token *oauth2.Token) (*AuthUser, error)

FetchAuthUser returns an AuthUser instance based the Twitch's user api.

API reference: https://dev.twitch.tv/docs/api/reference#get-users

func (*Twitch) FetchRawUserInfo

func (p *Twitch) FetchRawUserInfo(token *oauth2.Token) ([]byte, error)

FetchRawUserInfo implements Provider.FetchRawUserInfo interface method.

This differ from BaseProvider because Twitch requires the Client-Id header.

type Twitter added in v0.6.0

type Twitter struct {
	BaseProvider
}

Twitter allows authentication via Twitter OAuth2.

func NewTwitterProvider added in v0.6.0

func NewTwitterProvider() *Twitter

NewTwitterProvider creates new Twitter provider instance with some defaults.

func (*Twitter) FetchAuthUser added in v0.6.0

func (p *Twitter) FetchAuthUser(token *oauth2.Token) (*AuthUser, error)

FetchAuthUser returns an AuthUser instance based on the Twitter's user api.

API reference: https://developer.twitter.com/en/docs/twitter-api/users/lookup/api-reference/get-users-me

type VK added in v0.17.0

type VK struct {
	BaseProvider
}

VK allows authentication via VK OAuth2.

func NewVKProvider added in v0.17.0

func NewVKProvider() *VK

NewVKProvider creates new VK provider instance with some defaults.

Docs: https://dev.vk.com/api/oauth-parameters

func (*VK) FetchAuthUser added in v0.17.0

func (p *VK) FetchAuthUser(token *oauth2.Token) (*AuthUser, error)

FetchAuthUser returns an AuthUser instance based on VK's user api.

API reference: https://dev.vk.com/method/users.get

type Yandex added in v0.17.0

type Yandex struct {
	BaseProvider
}

Yandex allows authentication via Yandex OAuth2.

func NewYandexProvider added in v0.17.0

func NewYandexProvider() *Yandex

NewYandexProvider creates new Yandex provider instance with some defaults.

Docs: https://yandex.ru/dev/id/doc/en/

func (*Yandex) FetchAuthUser added in v0.17.0

func (p *Yandex) FetchAuthUser(token *oauth2.Token) (*AuthUser, error)

FetchAuthUser returns an AuthUser instance based on Yandex's user api.

API reference: https://yandex.ru/dev/id/doc/en/user-information#response-format

Jump to

Keyboard shortcuts

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