Skip to content

Commit 79b664d

Browse files
committed
feat: enhance logging in OAuth flow with additional cookie and request details
1 parent c76af14 commit 79b664d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

backend/handlers/oauth.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ func (h *OAuthHandler) Login(c echo.Context) error {
5454
slog.Info("OAuth state cookie set",
5555
"provider", provider,
5656
"state", state,
57+
"redirect_url", redirectURL,
58+
"cookie_path", cookie.Path,
59+
"cookie_secure", cookie.Secure,
60+
"cookie_samesite", cookie.SameSite,
5761
)
5862

5963
return c.String(http.StatusOK, redirectURL)
@@ -72,11 +76,23 @@ func (h *OAuthHandler) Callback(c echo.Context) error {
7276
cookieState = cookie.Value
7377
}
7478

79+
// Debug: log all cookies and headers
80+
allCookies := c.Cookies()
81+
cookieNames := make([]string, len(allCookies))
82+
for i, ck := range allCookies {
83+
cookieNames[i] = ck.Name
84+
}
85+
7586
slog.Info("OAuth callback received",
7687
"provider", provider,
7788
"state_from_query", state,
7889
"state_from_cookie", cookieState,
7990
"cookie_found", err == nil,
91+
"cookie_error", err,
92+
"all_cookies", cookieNames,
93+
"request_host", c.Request().Host,
94+
"request_scheme", c.Scheme(),
95+
"referer", c.Request().Header.Get("Referer"),
8096
)
8197

8298
// Clear the state cookie

0 commit comments

Comments
 (0)