add debug logs and switch to logrus for logs

This commit is contained in:
Alisdair MacLeod
2026-01-28 15:44:35 +00:00
parent a9ce9f8d5a
commit 3d116c9d33
4 changed files with 86 additions and 82 deletions

View File

@@ -5,7 +5,6 @@ import (
"crypto/rand"
"encoding/base64"
"fmt"
"log/slog"
"net/http"
"net/url"
"strings"
@@ -13,6 +12,7 @@ import (
"time"
"github.com/coreos/go-oidc/v3/oidc"
log "github.com/sirupsen/logrus"
"golang.org/x/oauth2"
)
@@ -162,7 +162,7 @@ func (o *OIDC) handleCallback(w http.ResponseWriter, r *http.Request) {
// Exchange code for token
token, err := o.oauthConfig.Exchange(r.Context(), code)
if err != nil {
slog.Error("Token exchange failed", "error", err)
log.WithError(err).Error("Token exchange failed")
http.Error(w, "Authentication failed", http.StatusUnauthorized)
return
}