discordauth

package
v0.0.0-...-dbefbc8 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authenticator

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

func NewAuthenticator

func NewAuthenticator(client *http.Client, clientID string, clientSecret string, redirectURL string, scopes []string) *Authenticator

NewAuthenticator create a new EVE SSO Authenticator. Requires your application clientID, clientSecret, and redirectURL. RedirectURL must match exactly to what you registered with CCP.

func (*Authenticator) AuthorizeURL

func (c *Authenticator) AuthorizeURL(state string, onlineAccess bool, scopes []string) string

AuthorizeURL returns a url for an end user to authenticate with EVE SSO and return success to the redirectURL. It is important to create a significatly unique state for this request and verify the state matches when returned to the redirectURL.

func (*Authenticator) ChangeAuthURL

func (c *Authenticator) ChangeAuthURL(url string)

ChangeAuthURL changes the oauth2 configuration url for authentication

func (*Authenticator) ChangeTokenURL

func (c *Authenticator) ChangeTokenURL(url string)

ChangeTokenURL changes the oauth2 configuration url for token

func (*Authenticator) TokenExchange

func (c *Authenticator) TokenExchange(code string) (*oauth2.Token, error)

TokenExchange exchanges the code returned to the redirectURL with the CREST server to an access token. A caching client must be passed. This client MUST cache per CCP guidelines or face banning.

func (*Authenticator) TokenSource

func (c *Authenticator) TokenSource(token *oauth2.Token) oauth2.TokenSource

TokenSource creates a refreshable token that can be passed to ESI functions

func (*Authenticator) Verify

func (c *Authenticator) Verify(auth oauth2.TokenSource) (*MeResponse, error)

Verify the client and collect user information.

type MeResponse

type MeResponse struct {
	ID            string
	UserName      string
	Discriminator string
	Avatar        string
	Verified      string
	Email         string
}

Jump to

Keyboard shortcuts

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