Skip to content
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


loc license discord goreportcard codefactor

HTTP function handlers to easily add OAuth2 client support to your Go application

AppConf Schema

type AppConf struct {
	For    string `json:"for"`
	ID     string `json:"id"`
	Secret string `json:"secret"`
	Extra1 string `json:"extra_1"`
	Extra2 string `json:"extra_2"`
	Extra3 string `json:"extra_3"`
  • "for" is the short-code this config refers to.
  • "id" is your Client ID.
  • "secret" is for your Client Secret.
  • Extra 1, 2, and 3 are filler spots for misc. info your app may need, such as Discord's Bot Token for example.

Creating Credentials

In order to use an app that uses this library, you will need to create an app on your Identity Provider of choice. Below, you will see a table of the supported Identity Providers and a link to the respective dashboards where you can go to create your app and obtain your App ID and App Secret.

Identity Provider Short Code Developer Dashboard
Amazon amazon
Discord discord
Facebook facebook
GitHub github
Google google
Microsoft microsoft
Reddit reddit


$ go get -v

Provider Schema

type Provider struct {
	ID           string `json:"id"`
	AuthorizeURL string `json:"authorize_url"`
	TokenURL     string `json:"token_url"`
	MeURL        string `json:"me_url"`
	Scope        string `json:"scope"`
	NameProp     string `json:"name_prop"`
	NamePrefix   string `json:"name_prefix"`
	Logo         string `json:"logo"`
	Color        string `json:"color"`
	Customable   string `json:"customable"`
  • "id" is the short-code this is creating.
  • "authorize_url" is the OAuth2 authorization URL.
  • "token_url" is the OAuth2 token URL.
  • "me_url" is the service's URL to get the currently logged in user.
  • "scope" is the OAuth2 scope required to be able to get the currently logged in user.
  • "name_prop" is the JSON key of current user's real name in the response of fetching "me_url".
  • "name_prefix" is any prefix to put in front of all names, this is typically @, u/, blank, etc.

AppConf Details for Self-Hosted Services

There are also a number of providers that allow you to specify a custom domain for that provider. They are accessed as such:

"clients": [
		"for": "{provider_id},{domain}",
		"id": "",
		"secret": ""

So for example, if adding a login config for, your "for" key would be "mastodon,"

The full list of customizable provider are as follows:

Identity Provider Short Code Home Site
Gitea gitea
Gitlab gitlab
mastodon mastodon
pleroma pleroma




HTTP handler functions to allow you to easily add OAuth2 login support to your Go application




No releases published


No packages published