Use oauth2 package's PasswordCredentialsToken method

Signed-off-by: Vartan Benohanian <vartanbeno@gmail.com>
This commit is contained in:
Vartan Benohanian
2020-08-06 17:41:20 -04:00
parent e49f4bf738
commit a9c581df34
4 changed files with 65 additions and 62 deletions
+11
View File
@@ -35,6 +35,17 @@ func FromEnv(c *Client) error {
return nil
}
// WithCredentials sets the necessary values for the client to authenticate via OAuth2.
func WithCredentials(id, secret, username, password string) Opt {
return func(c *Client) error {
c.ID = id
c.Secret = secret
c.Username = username
c.Password = password
return nil
}
}
// WithBaseURL sets the base URL for the client to make requests to.
func WithBaseURL(u string) Opt {
return func(c *Client) error {