oauth

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RequestFailed is the error message when a request fails.
	RequestFailed = "request failed"
	// ResponseFailed is the error message when a response fails.
	ResponseFailed = "response failed"
)

Variables

This section is empty.

Functions

func GetCallbackURL

func GetCallbackURL() string

GetCallbackURL gets the callback URL.

func GetDiscordAccessToken

func GetDiscordAccessToken(ctx context.Context, code string) (string, error)

GetDiscordAccessToken gets the access token from Discord.

func GetDiscordData

func GetDiscordData(ctx context.Context, accessToken string) (string, error)

GetDiscordData gets the user data from Discord.

func GetDiscordURL

func GetDiscordURL() string

GetDiscordURL gets the Discord client ID.

func GetFrontendURL

func GetFrontendURL() string

GetFrontendURL gets the frontend URL.

func GetGithubAccessToken

func GetGithubAccessToken(ctx context.Context, code string) (string, error)

GetGithubAccessToken gets the access token from Github using the code.

func GetGithubClientID

func GetGithubClientID() string

GetGithubClientID gets the Github client ID.

func GetGithubData

func GetGithubData(ctx context.Context, accessToken string) (string, error)

GetGithubData gets the user data from Github using the access token.

func InitDiscord

func InitDiscord(config DiscordConfig)

InitDiscord initializes the Discord oauth configuration.

func InitGithub

func InitGithub(config GithubConfig)

InitGithub initializes the Github oauth configuration.

func SetOauthConfig

func SetOauthConfig(config GlobalConfig)

SetOauthConfig sets the oauth configuration.

Types

type DiscordConfig

type DiscordConfig struct {
	ClientID     string // ClientID is the client ID for Discord.
	ClientSecret string // ClientSecret is the client secret for Discord.
	URL          string // URL is the URL for Discord.
}

type GithubConfig

type GithubConfig struct {
	ClientID     string // ClientID is the client ID for Github.
	ClientSecret string // ClientSecret is the client secret for Github.
}

type GlobalConfig

type GlobalConfig struct {
	CallbackURL string // CallbackURL is the callback URL for oauth.
	FrontendURL string // FrontendURL is the frontend URL for oauth.
}

GlobalConfig is the global configuration for oauth.

type JSONHelperSingleton added in v1.2.2

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

JSONHelperSingleton is a singleton for the json helper.

func GetJSONHelperInstance added in v1.2.2

func GetJSONHelperInstance() *JSONHelperSingleton

GetJSONHelperInstance gets the json helper instance.

func (*JSONHelperSingleton) GetJSONHelper added in v1.2.2

func (j *JSONHelperSingleton) GetJSONHelper() json.Helper

GetJSONHelper gets the json helper.

func (*JSONHelperSingleton) SetJSONHelper added in v1.2.2

func (j *JSONHelperSingleton) SetJSONHelper(helper json.Helper)

SetJSONHelper sets the json helper.

Jump to

Keyboard shortcuts

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