oauth

package
v0.0.0-...-986c4e7 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2024 License: AGPL-3.0 Imports: 8 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

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

func GetFrontendURL

func GetFrontendURL() string

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

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)

Types

type DiscordConfig

type DiscordConfig struct {
	ClientID     string
	ClientSecret string
	URL          string
}

type DiscordLogin

type DiscordLogin struct {
	ID       string `json:"id"`
	Username string `json:"username"`
	Avatar   string `json:"avatar"`
	Email    string `json:"email"`
}

DiscordLogin is a struct that represents the Discord login response.

type GithubConfig

type GithubConfig struct {
	ClientID     string
	ClientSecret string
}

type GlobalConfig

type GlobalConfig struct {
	CallbackURL string
	FrontendURL string
}

Jump to

Keyboard shortcuts

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