Help us shape the future of Go! Take the 2026 Go Developer Survey

github

package
v0.1.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package github configures GitHub OAuth 2.0 sign-in for the oauth plugin.

GitHub is not an OpenID Connect provider: the token endpoint returns no ID token, so identity comes from GitHub's authenticated user API using the transient access token. The immutable subject is the account's numeric "id". The mutable "login", the email addresses and the profile are never used.

Index

Constants

View Source
const (
	ID               = "github"
	Namespace        = "https://github.com"
	AuthorizationURL = "https://github.com/login/oauth/authorize"
	TokenURL         = "https://github.com/login/oauth/access_token"
	UserURL          = "https://api.github.com/user"
)

Endpoints are fixed for github.com. GitHub Enterprise Server hosts would need a reviewed adapter with their own namespace; this package does not guess.

Variables

This section is empty.

Functions

func Provider

func Provider(c Config) oauth.Provider

Provider returns the engine specification: S256 PKCE, the fixed github.com endpoints and the authenticated user API as the identity source. oauth.New validates the client ID, secret, redirect URL and scopes.

Types

type Config

type Config struct {
	ClientID     string
	ClientSecret sigil.Secret
	// RedirectURL is the exact HTTPS authorization callback URL registered on
	// the OAuth App. GitHub permits any port for localhost callbacks.
	RedirectURL string
	// Scopes are optional. The default empty scope grants read-only access to
	// public profile information, which is all the identity API call needs.
	Scopes []string
}

Config is trusted host configuration for one GitHub OAuth App.

Jump to

Keyboard shortcuts

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