From b1001fbefffb485c7223eb12889f38279001a1e2 Mon Sep 17 00:00:00 2001 From: Raajheer1 Date: Fri, 24 May 2024 15:57:59 -0500 Subject: [PATCH] Add debug code --- external/v3/user/login.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/external/v3/user/login.go b/external/v3/user/login.go index 662a5ba..53648f1 100644 --- a/external/v3/user/login.go +++ b/external/v3/user/login.go @@ -90,11 +90,15 @@ func GetLoginCallback(w http.ResponseWriter, r *http.Request) { return } + fmt.Println("Decoded Session Cookie") + if r.URL.Query().Get("state") != session["state"] { utils.Render(w, r, utils.ErrForbidden) return } + fmt.Println("State Matched") + token, err := oauth.OAuthConfig.Exchange(r.Context(), r.URL.Query().Get("code")) if err != nil { utils.Render(w, r, utils.ErrInternalServer) @@ -120,6 +124,8 @@ func GetLoginCallback(w http.ResponseWriter, r *http.Request) { _ = resp.Body.Close() }() + fmt.Println("Got User Info") + body, err := io.ReadAll(resp.Body) if err != nil { utils.Render(w, r, utils.ErrInternalServer) @@ -131,6 +137,8 @@ func GetLoginCallback(w http.ResponseWriter, r *http.Request) { return } + fmt.Println(body) + user := &VATSIMUser{} if err := json.Unmarshal(body, user); err != nil { utils.Render(w, r, utils.ErrInternalServer)