auth

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package auth obtains API tokens by delegating entirely to the glab and gh CLIs. gu never reads a credential file and never performs an OAuth flow: the user's only setup step is `glab auth login` / `gh auth login`.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Token

func Token(ctx context.Context, p config.ProfileConfig, h Host) (string, error)

Token fetches an API token for the host by asking the provider's CLI. The token is held in memory and never written anywhere by gu.

Types

type Host

type Host struct {
	Provider Provider
	Name     string
	Username string
}

Host is one authenticated endpoint for one profile.

func Hosts

func Hosts(ctx context.Context, p config.ProfileConfig) ([]Host, error)

Hosts lists the hosts this profile is logged in to, across both providers. A provider whose CLI is not installed, or which reports no login, simply contributes no hosts; that is not an error, because gu must work for a user who has only one of the two CLIs.

type Provider

type Provider string

Provider identifies which CLI and SDK back a host.

const (
	GitLab Provider = "gitlab"
	GitHub Provider = "github"
)

The supported providers.

func (Provider) Binary

func (p Provider) Binary() string

Binary returns the CLI executable name for a provider.

Jump to

Keyboard shortcuts

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