Skip to content

Commit

Permalink
Add debug code
Browse files Browse the repository at this point in the history
  • Loading branch information
Raajheer1 committed May 24, 2024
1 parent c5cdda2 commit b1001fb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions external/v3/user/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit b1001fb

Please sign in to comment.