providers/proxy: better log outpost token errors

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Jens Langhammer 2023-02-06 20:26:43 +01:00
parent 1919a9dd77
commit 61b06eff06
No known key found for this signature in database

View file

@ -3,6 +3,7 @@ package application
import ( import (
"context" "context"
"encoding/json" "encoding/json"
"io"
"net/http" "net/http"
"net/url" "net/url"
"strings" "strings"
@ -29,7 +30,11 @@ func (a *Application) attemptBasicAuth(username, password string) *Claims {
req.Header.Set("Content-Type", "application/x-www-form-urlencoded") req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
res, err := a.httpClient.Do(req) res, err := a.httpClient.Do(req)
if err != nil || res.StatusCode > 200 { if err != nil || res.StatusCode > 200 {
a.log.WithError(err).Warning("failed to send token request") b, err := io.ReadAll(res.Body)
if err != nil {
b = []byte(err.Error())
}
a.log.WithError(err).WithField("body", string(b)).Warning("failed to send token request")
return nil return nil
} }
var token TokenResponse var token TokenResponse