Add more log messages to get token function
This commit is contained in:
parent
3d97b0174b
commit
a937cb9f58
|
@ -50,17 +50,20 @@ type GetTokenParams struct {
|
|||
func GetToken(params *GetTokenParams) (*Token, error) {
|
||||
v, err := query.Values(params)
|
||||
if err != nil {
|
||||
slog.Error("failed to encode token", slog.Any("error", err))
|
||||
return nil, err
|
||||
}
|
||||
|
||||
res, err := http.Post(TokenUrl, "application/x-www-form-urlencoded", strings.NewReader(v.Encode()))
|
||||
if err != nil {
|
||||
slog.Error("failed to get token", slog.Any("error", err))
|
||||
return nil, err
|
||||
}
|
||||
defer res.Body.Close()
|
||||
|
||||
body := make([]byte, res.ContentLength)
|
||||
if _, err := res.Body.Read(body); err != nil {
|
||||
slog.Error("failed to read response", slog.Any("error", err))
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue