make login a private method
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Steven Polley 2023-11-13 17:29:45 -07:00
parent 4ff4c62daf
commit 8a61bba688

View File

@ -88,11 +88,9 @@ func (c *client) processResponse(res *http.Response, out interface{}) error {
// and exchanges it for an access token. Returns a timer that
// expires when the login session is over.
// TODO - Return a proper error when login fails with HTTP 400 - Bad Request
func (c *client) Login() error {
login := loginServerURL
func (c *client) login() error {
vars := url.Values{"grant_type": {"refresh_token"}, "refresh_token": {c.Credentials.RefreshToken}}
res, err := c.httpClient.PostForm(login+"token", vars)
res, err := c.httpClient.PostForm(loginServerURL+"token", vars)
if err != nil {
return err
@ -126,7 +124,7 @@ func newClient(refreshToken string) (*client, error) {
transport: transport,
}
err := c.Login()
err := c.login()
if err != nil {
return nil, err
}