auth

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

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