Documentation
¶
Index ¶
- Variables
- func ClientKeyring() (keyring gokeyring.Keyring, err error)
- func InteractiveAuthorizer(oauthAuthorizeURL string) (code string, err error)
- func Login(user string, allowHTTP bool, keyring gokeyring.Keyring, authorizer Authorizer) error
- func LoginKeyring(useCleartextFileKeyring bool) (keyring gokeyring.Keyring, err error)
- func Logout(user string) error
- func NewGtsTestrigAuthorizer(t *testing.T) func(oauthAuthorizeURL string) (code string, err error)
- func Switch(user string) error
- func Whoami() (string, error)
- type Authorizer
- type Client
Constants ¶
This section is empty.
Variables ¶
var ErrMissingCredentials = missingCredentialsError{/* contains filtered or unexported fields */}
ErrMissingCredentials can be compared to with Is() to match errors caused by missing or inaccessible credentials.
Functions ¶
func ClientKeyring ¶
ClientKeyring returns the appropriate keyring (system or file) but does not change the keyring pref.
func InteractiveAuthorizer ¶
InteractiveAuthorizer prompts the user to log in with their browser and then enter their auth code.
func LoginKeyring ¶
LoginKeyring sets the keyring pref and returns the appropriate keyring (system or file).
func NewGtsTestrigAuthorizer ¶ added in v1.1.1
NewGtsTestrigAuthorizer returns an authorizer func which logs into a GTS testrig and returns an OOB auth code. This should only be used in tests, but is in the auth package so tests in other packages can load it.
Types ¶
type Authorizer ¶
Authorizer is a function that can exchange an OAuth authorization URL for an authorization code.
type Client ¶
type Client struct {
Client *apiclient.GoToSocialSwaggerDocumentation
Auth runtime.ClientAuthInfoWriter
Flavor flavors.Flavor
// contains filtered or unexported fields
}
Client is a GtS API client with attached authentication credentials and rate limiter. Credentials may be no-op.
func GtsTestrigClient ¶ added in v1.1.1
GtsTestrigClient returns a client which is logged in to the GTS testrig. TODO: we might want to tear down and restart the testrig for every test, in which case this is inadequate.
func NewAuthClient ¶
NewAuthClient loads previously stored credentials for the current user, and returns an authorized client instance. If there aren't any credentials, it returns an error.