auth

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: MPL-2.0 Imports: 11 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

Overview

Package auth implements the authentication flow for the CLI

Index

Constants

View Source
const (
	// ZeaburAccessTokenConfirmEndpoint is the dashboard page that mints an access token for the CLI.
	// The path keeps its historical "api-key" name so older CLI builds continue to resolve it.
	ZeaburAccessTokenConfirmEndpoint = constant.ZeaburDashURL + "/auth/api-key/confirm"

	ZeaburAccessTokenSettingsURL = constant.ZeaburDashURL + "/account/api-keys"
)
View Source
const (
	// AccessTokenPrefix marks a scoped personal access token issued by createAccessToken.
	AccessTokenPrefix = "zat_"
	// LegacyAPIKeyPrefix marks an unscoped API key issued by the deprecated createApiKey.
	LegacyAPIKeyPrefix = "sk-"
)
View Source
const LegacyAPIKeyDeprecationMessage = "You are authenticated with a legacy API key, which is deprecated. " +
	"Run `zeabur auth login` to migrate to an access token, " +
	"or create one at " + ZeaburAccessTokenSettingsURL + " for use with ZEABUR_TOKEN."

Variables

This section is empty.

Functions

func IsLegacyAPIKey added in v0.22.0

func IsLegacyAPIKey(token string) bool

Types

type CallbackServer

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

func NewCallbackServer

func NewCallbackServer() (*CallbackServer, error)

func (*CallbackServer) Close

func (s *CallbackServer) Close() error

func (*CallbackServer) GetCallbackURL

func (s *CallbackServer) GetCallbackURL() string

func (*CallbackServer) Port

func (s *CallbackServer) Port() int

func (*CallbackServer) Serve

func (s *CallbackServer) Serve() error

func (*CallbackServer) WaitForToken

func (s *CallbackServer) WaitForToken(ctx context.Context) (TokenResponse, error)

type Client

type Client interface {
	GenerateToken(ctx context.Context) (string, error)
}

type ImplicitFlowClient

type ImplicitFlowClient struct {
	Endpoint url.URL
	// contains filtered or unexported fields
}

func NewImplicitFlowClient

func NewImplicitFlowClient(callbackServer *CallbackServer) *ImplicitFlowClient

func (*ImplicitFlowClient) GenerateToken

func (c *ImplicitFlowClient) GenerateToken(ctx context.Context) (token string, err error)

type TokenResponse

type TokenResponse struct {
	Token string
	State string
}

Jump to

Keyboard shortcuts

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