Remove log messages from token endpoint

This commit is contained in:
Evan Fiordeliso 2024-03-07 18:56:09 -05:00
parent a937cb9f58
commit 5c76a4b1c3
1 changed files with 1 additions and 11 deletions

View File

@ -2,7 +2,6 @@ package auth
import (
"encoding/json"
"log/slog"
"net/http"
"strings"
"time"
@ -50,26 +49,17 @@ 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
}
var token Token
if err := json.Unmarshal(body, &token); err != nil {
slog.Debug("failed to decode token", slog.Any("error", err), slog.String("body", string(body)))
if err := json.NewDecoder(res.Body).Decode(&token); err != nil {
return nil, err
}