Skip to content

Commit

Permalink
log profile
Browse files Browse the repository at this point in the history
  • Loading branch information
RobKraft committed Dec 22, 2024
1 parent 1d65a91 commit 8e97b12
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ func CallbackHandler(w http.ResponseWriter, r *http.Request) {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
log.Println("callback handler")

if r.URL.Query().Get("state") != session.Values["state"] {
http.Error(w, "Invalid state parameter", http.StatusBadRequest)
Expand All @@ -71,14 +70,13 @@ func CallbackHandler(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusUnauthorized)
return
}
log.Printf("token found: %v", token)

rawIDToken, ok := token.Extra("id_token").(string)
if !ok {
http.Error(w, "No id_token field in oauth2 token.", http.StatusInternalServerError)
return
}
log.Printf("id_token found: %v", rawIDToken)

oidcConfig := &oidc.Config{
ClientID: auth0ClientID,
}
Expand All @@ -89,7 +87,6 @@ func CallbackHandler(w http.ResponseWriter, r *http.Request) {
http.Error(w, "Failed to verify ID Token: "+err.Error(), http.StatusInternalServerError)
return
}
log.Printf("id_token verified: %v", idToken)

// Getting now the userInfo
var profile map[string]interface{}
Expand All @@ -107,6 +104,9 @@ func CallbackHandler(w http.ResponseWriter, r *http.Request) {
return
}

log.Printf("rawIDToken: %v", rawIDToken)
log.Printf("profile: %v", profile)

// Redirect to logged in page
http.Redirect(w, r, "/", http.StatusSeeOther)
}
Expand Down

0 comments on commit 8e97b12

Please sign in to comment.