authflow

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package authflow provides authentication flows for Bitbucket. Bitbucket supports two authentication methods: 1. API Tokens (new) - requires Atlassian account email + API token 2. App Passwords (legacy) - requires Bitbucket username + app password OAuth device flow is not supported.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCurrentLogin

func GetCurrentLogin(token string) (string, error)

GetCurrentLogin extracts the username from a Bitbucket token. Bitbucket tokens are stored as "username:app_password".

Types

type AuthFlowResult

type AuthFlowResult struct {
	Username string
	Token    string // This is "email:api_token" or "username:app_password" for Bitbucket
}

AuthFlowResult contains the result of an authentication flow.

func APITokenAuth

func APITokenAuth(hostname string, IO *iostreams.IOStreams, prompter Prompter) (*AuthFlowResult, error)

APITokenAuth performs authentication using a Bitbucket API Token. This is the recommended authentication method for Bitbucket Cloud. API tokens require Atlassian account email (not username) for Basic Auth.

func AppPasswordAuth

func AppPasswordAuth(hostname string, IO *iostreams.IOStreams, prompter Prompter) (*AuthFlowResult, error)

AppPasswordAuth performs authentication using a Bitbucket App Password (legacy). Consider using APITokenAuth instead for new integrations.

type Prompter

type Prompter interface {
	Input(prompt, defaultValue string) (string, error)
	Password(prompt string) (string, error)
	Select(prompt, defaultValue string, options []string) (int, error)
}

Prompter interface for authentication prompts.

Jump to

Keyboard shortcuts

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