github

package
v1.20.1 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2026 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*oauth2.Config
}

func New

func New(config *Config) *Client

func (*Client) GetPrimaryEmail

func (c *Client) GetPrimaryEmail(token string) (string, error)

GetPrimaryEmail fetches the primary verified email from the GitHub emails API.

func (*Client) GetUserInfo

func (c *Client) GetUserInfo(token string) (*UserInfo, error)

GetUserInfo fetches the user profile from the GitHub API using the access token. If the email is not publicly visible on the profile, it falls back to the emails API.

type Config

type Config struct {
	ClientID     string
	ClientSecret string
	RedirectURL  string
}

type EmailInfo

type EmailInfo struct {
	Email    string `json:"email"`
	Primary  bool   `json:"primary"`
	Verified bool   `json:"verified"`
}

EmailInfo represents a GitHub email address.

type UserInfo

type UserInfo struct {
	OpenID  int64  `json:"id"`
	Login   string `json:"login"`
	Name    string `json:"name"`
	Email   string `json:"email"`
	Avatar  string `json:"avatar_url"`
	HTMLURL string `json:"html_url"`
}

UserInfo represents the GitHub user information.

Jump to

Keyboard shortcuts

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