Add debug message in GetToken function
This commit is contained in:
parent
4803b82eba
commit
98d925636c
|
@ -2,6 +2,7 @@ package auth
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"log/slog"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
|
@ -57,8 +58,14 @@ func GetToken(params *GetTokenParams) (*Token, error) {
|
|||
}
|
||||
defer res.Body.Close()
|
||||
|
||||
body := make([]byte, res.ContentLength)
|
||||
if _, err := res.Body.Read(body); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var token Token
|
||||
if err := json.NewDecoder(res.Body).Decode(&token); err != nil {
|
||||
if err := json.Unmarshal(body, &token); err != nil {
|
||||
slog.Debug("failed to decode token", slog.Any("error", err), slog.String("body", string(body)))
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue