return error
This commit is contained in:
parent
0750bedc85
commit
49f49b8b97
|
@ -78,12 +78,17 @@ func (c *Client) Authenticate(username, password string) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
|
||||
resp, err := c.Do(req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode != 200 {
|
||||
return fmt.Errorf("bad authorization: %v", resp.Status)
|
||||
}
|
||||
|
||||
res := struct {
|
||||
AccessToken string `json:"access_token"`
|
||||
}{}
|
||||
|
|
Loading…
Reference in New Issue
Block a user