auth

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: Apache-2.0 Imports: 18 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authenticator

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

func New

func New() *Authenticator

NewGitHubApp creates a new GitHub OAuth application for device flow

func (*Authenticator) Authenticate

func (a *Authenticator) Authenticate(ctx context.Context) error

Authenticate performs the complete device flow authentication in the user's terminal and web browser

func (*Authenticator) GetGitHubClient

func (a *Authenticator) GetGitHubClient() (*github.Client, error)

GetGitHubClient returns a GitHub client preconfigured with the logged-in token.

func (*Authenticator) ReadToken

func (a *Authenticator) ReadToken() (string, error)

ReadToken reads the persisted token and returns it

func (*Authenticator) WhoAmI

func (a *Authenticator) WhoAmI() (*models.Actor, error)

WhoAmI returns the user authenticated with the token

type DeviceCodeResponse

type DeviceCodeResponse struct {
	DeviceCode      string `json:"device_code"`
	UserCode        string `json:"user_code"`
	VerificationURI string `json:"verification_uri"`
	ExpiresIn       int    `json:"expires_in"`
	Interval        int    `json:"interval"`
}

DeviceCodeResponse models the github device code response

type TokenResponse

type TokenResponse struct {
	AccessToken string `json:"access_token"`
	TokenType   string `json:"token_type"`
	Scope       string `json:"scope"`
	Error       string `json:"error"`
	ErrorDesc   string `json:"error_description"`
}

TokenResponse is the data structure returned when exchanging tokens

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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