package
0.18.10
Repository: https://github.com/disgoorg/disgo.git
Documentation: pkg.go.dev

# README

oauth2

OAuth2 module of disgo

Getting Started

OAuth2 can be used to authenticate users with Discord on your website. For this to work, you need to create an application on the Discord Developer Portal and get the client ID and secret. Next you need to put in your redirect URL.

Usage

See here for an example.

# Functions

DefaultConfig is the configuration which is used by default.
DefaultStateControllerConfig is the default configuration for the StateController.
New returns a new OAuth2 client with the given ID, secret and ConfigOpt(s).
NewStateController returns a new empty StateController.
WithLogger applies a custom logger to the OAuth2 client.
WithMaxTTL sets the maximum time to live for a state.
WithNewStateFunc sets the function which is used to generate a new random state.
WithOAuth2 applies a custom rest.OAuth2 to the OAuth2 client.
WithRestClient applies a custom rest.Client to the OAuth2 client.
WithRestClientConfigOpts applies rest.ConfigOpt for the rest.Client to the OAuth2 client.
WithStateController applies a custom StateController to the OAuth2 client.
WithStateControllerLogger sets the logger for the StateController.
WithStateControllerOpts applies all StateControllerConfigOpt(s) to the StateController.
WithStates loads states from an existing map.

# Variables

ErrMissingOAuth2Scope is returned when a specific OAuth2 scope is missing.
ErrSessionExpired is returned when the Session has expired.
ErrStateNotFound is returned when the state is not found in the SessionController.

# Structs

No description provided by the author
Config is the configuration for the OAuth2 client.
Session represents a discord access token response (https://discord.com/developers/docs/topics/oauth2#authorization-code-grant-access-token-response).
StateControllerConfig is the configuration for the StateController.

# Interfaces

Client is a high level wrapper around Discord's OAuth2 API.
StateController is responsible for generating, storing and validating states.

# Type aliases

ConfigOpt can be used to supply optional parameters to New.
StateControllerConfigOpt is used to pass optional parameters to NewStateController.