github

package
v0.45.7 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultScopes

func DefaultScopes() []string

DefaultScopes returns the default GitHub scopes.

Types

type Config

type Config struct {
	ClientID     string
	ClientSecret string
	CallbackURL  string
	Scopes       []string

	AuthURL   string
	TokenURL  string
	UserURL   string
	EmailsURL string

	HTTPClient            *http.Client
	AllowInsecureLoopback bool
}

Config holds GitHub OAuth configuration.

type Provider

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

Provider implements social.SocialProvider for GitHub.

func New

func New(cfg Config) *Provider

New creates a new GitHub provider.

func (*Provider) AuthCodeURL

func (p *Provider) AuthCodeURL(state string, opts ...social.AuthCodeOption) string

AuthCodeURL implements social.SocialProvider.

func (*Provider) Exchange

func (p *Provider) Exchange(ctx context.Context, code string, opts ...social.ExchangeOption) (*social.Token, error)

Exchange implements social.SocialProvider.

func (*Provider) Name

func (p *Provider) Name() string

Name implements social.SocialProvider.

func (*Provider) RefreshToken

func (p *Provider) RefreshToken(ctx context.Context, refreshToken string) (*social.Token, error)

RefreshToken implements social.SocialProvider. GitHub tokens don't expire and can't be refreshed.

func (*Provider) UserInfo

func (p *Provider) UserInfo(ctx context.Context, token *social.Token) (*social.SocialProfile, error)

UserInfo implements social.SocialProvider.

func (*Provider) ValidateToken

func (p *Provider) ValidateToken(ctx context.Context, token *social.Token) error

ValidateToken implements social.SocialProvider.

Jump to

Keyboard shortcuts

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