Documentation ¶
Index ¶
Constants ¶
const RedactedToken = "--REDACTED--"
RedactedToken is the value returned by calling String() on a Token.
Variables ¶
var (
ErrInvalidURL = fmt.Errorf("must provide valid tavern url")
)
ErrInvalidURL occurs if an invalid Tavern url is provided.
Functions ¶
This section is empty.
Types ¶
type BrowserFunc ¶
The BrowserFunc type is an adapter to allow the use of ordinary functions as browsers. If f is a function with the appropriate signature, then BrowserFunc(f) is a Browser that calls f.
func (BrowserFunc) OpenURL ¶
func (f BrowserFunc) OpenURL(tavernURL string) error
OpenURL calls f(tavernURL).
type Token ¶
type Token string
Token is a type alias for string that prevents sensitive information from being displayed.
func Authenticate ¶
Authenticate the user to the Tavern API using the provided browser. This will open the browser to a login URL, which will redirect to an http server (hosted locally) with authentication credentials. This prevents the need for copy pasting tokens manually.
After authenticating, the resulting Token may be used to authenticate to Tavern for HTTP requests. This should be done by calling the `Authenticate(request)` method on the returned token.
func (Token) Authenticate ¶
Authenticate the provided http request, using this token to authenticate to the Tavern API. It is recommended to use this method instead of manually configuring the request, such that if authentication implementation details are changed, the request will still be properly authenticated.