Documentation ¶
Index ¶
- Constants
- func GetCallbackURL() string
- func GetDiscordAccessToken(ctx context.Context, code string) (string, error)
- func GetDiscordData(ctx context.Context, accessToken string) (string, error)
- func GetDiscordURL() string
- func GetFrontendURL() string
- func GetGithubAccessToken(ctx context.Context, code string) (string, error)
- func GetGithubClientID() string
- func GetGithubData(ctx context.Context, accessToken string) (string, error)
- func InitDiscord(config DiscordConfig)
- func InitGithub(config GithubConfig)
- func SetOauthConfig(config GlobalConfig)
- type DiscordConfig
- type GithubConfig
- type GlobalConfig
- type JSONHelperSingleton
Constants ¶
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 GetDiscordAccessToken ¶
GetDiscordAccessToken gets the access token from Discord.
func GetDiscordData ¶
GetDiscordData gets the user data from Discord.
func GetGithubAccessToken ¶
GetGithubAccessToken gets the access token from Github using the code.
func GetGithubClientID ¶
func GetGithubClientID() string
GetGithubClientID gets the Github client ID.
func GetGithubData ¶
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 GithubConfig ¶
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.