login

package
v1.10.2 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigureProfile added in v1.6.0

func ConfigureProfile(config *config.Config, response *PollAPIKeyResponse) error

ConfigureProfile function sets config for this profile.

func InteractiveLogin

func InteractiveLogin(ctx context.Context, config *config.Config) error

InteractiveLogin lets the user set configuration on the command line

func Login

func Login(ctx context.Context, baseURL string, config *config.Config, input io.Reader) error

Login function is used to obtain credentials via stripe dashboard.

func PollForKey

func PollForKey(ctx context.Context, pollURL string, interval time.Duration, maxAttempts int) (*PollAPIKeyResponse, *Account, error)

PollForKey polls Stripe at the specified interval until either the API key is available or we've reached the max attempts.

func SuccessMessage added in v0.2.2

func SuccessMessage(ctx context.Context, account *Account, baseURL string, apiKey string) (string, error)

SuccessMessage returns the display message for a successfully authenticated user

Types

type Account added in v0.2.2

type Account struct {
	ID       string   `json:"id"`
	Settings Settings `json:"settings"`
}

Account is the most outer layer of the json response from Stripe

func GetUserAccount added in v1.5.6

func GetUserAccount(ctx context.Context, baseURL string, apiKey string) (*Account, error)

GetUserAccount retrieves the account information

type Dashboard added in v0.2.2

type Dashboard struct {
	DisplayName string `json:"display_name"`
}

Dashboard is within the Settings json response from Stripe

type Links struct {
	BrowserURL       string `json:"browser_url"`
	PollURL          string `json:"poll_url"`
	VerificationCode string `json:"verification_code"`
}

Links provides the URLs for the CLI to continue the login flow

func GetLinks(ctx context.Context, baseURL string, deviceName string) (*Links, error)

GetLinks provides the URLs for the CLI to continue the login flow

type PollAPIKeyResponse added in v0.6.0

type PollAPIKeyResponse struct {
	Redeemed               bool   `json:"redeemed"`
	AccountID              string `json:"account_id"`
	AccountDisplayName     string `json:"account_display_name"`
	LiveModeAPIKey         string `json:"livemode_key_secret"`
	LiveModePublishableKey string `json:"livemode_key_publishable"`
	TestModeAPIKey         string `json:"testmode_key_secret"`
	TestModePublishableKey string `json:"testmode_key_publishable"`
}

PollAPIKeyResponse returns the data of the polling client login

type Settings added in v0.2.2

type Settings struct {
	Dashboard Dashboard `json:"dashboard"`
}

Settings is within the Account json response from Stripe

Jump to

Keyboard shortcuts

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