cloud

package
v1.42.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Flow

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

Flow holds the state for the steps of our OAuth-like Web Application flow.

func InitFlow

func InitFlow() (*Flow, error)

InitFlow creates a new Flow instance by detecting a locally available port number.

func (*Flow) BrowserURL

func (f *Flow) BrowserURL(baseURL string) (string, error)

BrowserURL appends GET query parameters to baseURL and returns the url that the user should navigate to in their web browser.

func (*Flow) Close

func (f *Flow) Close() error

Close stops the local server.

func (*Flow) StartServer

func (f *Flow) StartServer(writeSuccess func(io.Writer)) error

StartServer starts the localhost server and blocks until it has received the web redirect. The writeSuccess function can be used to render a HTML page to the user upon completion.

func (*Flow) Wait

func (f *Flow) Wait(ctx context.Context) (string, error)

Wait blocks until the browser flow has completed and returns the access token.

type TokenResponse

type TokenResponse struct {
	Token string
	State string
}

TokenResponse represents the token received by the local server's callback handler.

Jump to

Keyboard shortcuts

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