github

package
v0.4.1 Latest Latest
Warning

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

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

Documentation

Overview

Package github implements the GitHub OAuth provider for Auth-All.

Index

Constants

View Source
const (
	DefaultAuthURL   = "https://github.com/login/oauth/authorize"
	DefaultTokenURL  = "https://github.com/login/oauth/access_token"
	DefaultUserURL   = "https://api.github.com/user"
	DefaultEmailsURL = "https://api.github.com/user/emails"
)

Default GitHub endpoints.

View Source
const ProviderID = "github"

ProviderID is the stable identifier of this provider.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Provider)

Option configures the provider.

func WithClientID

func WithClientID(v string) Option

WithClientID sets the OAuth client id.

func WithClientSecret

func WithClientSecret(v string) Option

WithClientSecret sets the OAuth client secret.

func WithEndpoints

func WithEndpoints(authURL, tokenURL, userURL, emailsURL string) Option

WithEndpoints overrides the provider endpoints. Tests use it to point at a deterministic fake GitHub server.

func WithHTTPClient

func WithHTTPClient(c *http.Client) Option

WithHTTPClient sets the HTTP client used for provider calls.

func WithScopes

func WithScopes(v ...string) Option

WithScopes replaces the requested scopes.

type Provider

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

Provider is the GitHub OAuth provider.

func New

func New(opts ...Option) *Provider

New returns a GitHub provider.

func (*Provider) AuthCodeURL

func (p *Provider) AuthCodeURL(req oauth.AuthRequest) (string, error)

AuthCodeURL implements oauth.Provider.

func (*Provider) Exchange

func (p *Provider) Exchange(ctx context.Context, req oauth.ExchangeRequest) (*oauth.Identity, error)

Exchange implements oauth.Provider.

func (*Provider) ID

func (p *Provider) ID() string

ID implements oauth.Provider.

func (*Provider) SupportsPKCE

func (p *Provider) SupportsPKCE() bool

SupportsPKCE implements oauth.Provider. GitHub does not accept a PKCE challenge on the OAuth app authorization endpoint.

func (*Provider) Validate

func (p *Provider) Validate() error

Validate reports missing configuration.

Jump to

Keyboard shortcuts

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