Documentation ¶
Overview ¶
Package authcord is a tiny Discord OAuth2 library over x/oauth2
Index ¶
Constants ¶
View Source
const APIUrl = "http://discordapp.com/api/v6"
APIUrl is Discord's base API Url
Variables ¶
View Source
var Endpoint = oauth2.Endpoint{ AuthURL: "https://discordapp.com/api/oauth2/authorize", TokenURL: "https://discordapp.com/api/oauth2/token", AuthStyle: oauth2.AuthStyleInHeader, }
Endpoint is Discord's OAuth2 endpoint
Functions ¶
This section is empty.
Types ¶
type Guild ¶
type Guild struct { ID string `json:"id"` Name string `json:"name"` Icon string `json:"icon"` Owner bool `json:"owner"` Permissions uint `json:"permissions"` }
Guild is a partial Guild object
type Session ¶
type Session struct { State string // a random 16 bit hex encoded string, to verify callback redirects // contains filtered or unexported fields }
Session is the Discord session used to initialize the OAuth2 flow. All methods called on Session will internally refresh the access token if it is invalid
func (*Session) AccessToken ¶
AccessToken fetches the internal access token
func (*Session) Callback ¶
Callback fetches an access token with the provided code and initializes an HTTP Client that can be used to do authenticated requests
type User ¶
type User struct { ID string `json:"id"` Username string `json:"username"` Discriminator string `json:"discriminator"` Avatar string `json:"avatar,omitempty"` Bot bool `json:"bot,omitempty"` MFAEnabled bool `json:"mfa_enabled,omitempty"` Locale string `json:"locale,omitempty"` Verified bool `json:"verified,omitempty"` Email string `json:"email,omitempty"` // only provided if email scope is passed Flags uint `json:"flags,omitempty"` PremiumType uint8 `json:"premium_type,omitempty"` }
User is a Discord user object as documented at https://discordapp.com/developers/docs/resources/user#user-object
Click to show internal directories.
Click to hide internal directories.