Documentation ¶
Index ¶
Constants ¶
View Source
const ( DiscordKeyModeID discordKeyMode = iota DiscordKeyModeEmail )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Discord ¶
type Discord struct { Gosesh Gosesher Config *oauth2.Config // contains filtered or unexported fields }
func NewDiscord ¶
func NewDiscord(sesh Gosesher, scopes DiscordScopes, credentials gosesh.OAuth2Credentials, redirectPath string, opts ...DiscordOpt) *Discord
Creates a new Discord OAuth2 provider. redirectPath should have a leading slash.
func (*Discord) NewUser ¶ added in v0.1.1
func (d *Discord) NewUser() gosesh.OAuth2User
func (*Discord) OAuth2Begin ¶
func (d *Discord) OAuth2Begin() http.HandlerFunc
func (*Discord) OAuth2Callback ¶
func (d *Discord) OAuth2Callback(handler gosesh.HandlerDone) http.HandlerFunc
type DiscordOpt ¶ added in v0.1.1
type DiscordOpt func(*Discord)
func WithDiscodHost ¶ added in v0.5.2
func WithDiscodHost(host string) DiscordOpt
To help with testing, this function allows you to set the Discord host to a different value (i.e. httptest.Server.URL).
func WithDiscordKeyMode ¶ added in v0.1.0
func WithDiscordKeyMode(mode discordKeyMode) DiscordOpt
type DiscordScopes ¶
type DiscordScopes struct {
Email bool
}
type DiscordUser ¶
type DiscordUser struct { ID string `json:"id"` Username string `json:"username"` Email string `json:"email,omitempty"` Verified bool `json:"verified,omitempty"` // contains filtered or unexported fields }
func (*DiscordUser) String ¶
func (user *DiscordUser) String() string
func (*DiscordUser) Unmarshal ¶
func (user *DiscordUser) Unmarshal(b []byte) error
type Google ¶ added in v0.5.0
type Google struct {
// contains filtered or unexported fields
}
func (*Google) NewUser ¶ added in v0.5.2
func (p *Google) NewUser() gosesh.OAuth2User
func (*Google) OAuth2Begin ¶ added in v0.5.0
func (p *Google) OAuth2Begin() http.HandlerFunc
func (*Google) OAuth2Callback ¶ added in v0.5.0
func (p *Google) OAuth2Callback(handler gosesh.HandlerDone) http.HandlerFunc
type GoogleOpt ¶ added in v0.5.2
type GoogleOpt func(*Google)
func WithGoogleHost ¶ added in v0.5.2
To help with testing, this function allows you to set the Discord host to a different value (i.e. httptest.Server.URL).
type GoogleUser ¶ added in v0.5.1
type GoogleUser struct { ID string `json:"id"` Email string `json:"email"` VerifiedEmail bool `json:"verified_email"` Picture string `json:"picture"` // contains filtered or unexported fields }
func (*GoogleUser) String ¶ added in v0.5.1
func (user *GoogleUser) String() string
func (*GoogleUser) Unmarshal ¶ added in v0.5.1
func (user *GoogleUser) Unmarshal(b []byte) error
type Gosesher ¶
type Gosesher interface { OAuth2Begin(cfg *oauth2.Config) http.HandlerFunc OAuth2Callback(user gosesh.OAuth2User, cfg *oauth2.Config, handler gosesh.HandlerDone) http.HandlerFunc Scheme() string Host() string }
type Provider ¶ added in v0.5.0
type Provider interface { OAuth2Begin() http.HandlerFunc OAuth2Callback(handler gosesh.HandlerDone) http.HandlerFunc }
Click to show internal directories.
Click to hide internal directories.