make login a private method
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
4ff4c62daf
commit
8a61bba688
@ -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
|
// and exchanges it for an access token. Returns a timer that
|
||||||
// expires when the login session is over.
|
// expires when the login session is over.
|
||||||
// TODO - Return a proper error when login fails with HTTP 400 - Bad Request
|
// TODO - Return a proper error when login fails with HTTP 400 - Bad Request
|
||||||
func (c *client) Login() error {
|
func (c *client) login() error {
|
||||||
login := loginServerURL
|
|
||||||
|
|
||||||
vars := url.Values{"grant_type": {"refresh_token"}, "refresh_token": {c.Credentials.RefreshToken}}
|
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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -126,7 +124,7 @@ func newClient(refreshToken string) (*client, error) {
|
|||||||
transport: transport,
|
transport: transport,
|
||||||
}
|
}
|
||||||
|
|
||||||
err := c.Login()
|
err := c.login()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user