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
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 ImplicitFlowClient ¶
func NewImplicitFlowClient ¶
func NewImplicitFlowClient(callbackServer *CallbackServer) *ImplicitFlowClient
func (*ImplicitFlowClient) GenerateToken ¶
func (c *ImplicitFlowClient) GenerateToken(ctx context.Context) (token string, err error)
type TokenResponse ¶
Click to show internal directories.
Click to hide internal directories.