Documentation
¶
Overview ¶
Package browserflow runs a browser-driven authorization flow over a local HTTP listener.
Index ¶
Constants ¶
View Source
const DefaultCallbackPath = "/callback"
DefaultCallbackPath is the conventional path for the OAuth-style callback handler.
View Source
const DefaultTimeout = 5 * time.Minute
DefaultTimeout is the wall-clock limit on a flow.
Variables ¶
This section is empty.
Functions ¶
func FindAvailableListener ¶
FindAvailableListener binds to a free port on 127.0.0.1 only.
func GenerateState ¶
GenerateState returns a 16-byte random URL-safe string suitable for OAuth state / CSRF protection.
Types ¶
type Logger ¶
Logger is a small interface for status updates during a flow; *output.Printer satisfies it.
type Options ¶
type Options struct {
Listener net.Listener // ownership transfers to Run; closed on return
State string // expected state value; required
OpenURL string // URL the browser is sent to; required
StartHandler http.Handler // optional; mounted at /start so OpenURL can be the local listener
CallbackPath string // path that captures code+state; defaults to DefaultCallbackPath
Timeout time.Duration // 0 → DefaultTimeout
Logger Logger // optional
SuccessTitle string // shown on the callback page; defaults to "Authentication successful"
SuccessBody string // shown on the callback page; defaults to a generic close-tab message
ErrorTitle string // shown on the callback page when GitHub/upstream returns an error
}
Options configure a single browser-driven flow run.
Click to show internal directories.
Click to hide internal directories.