Skip to content

Commit

Permalink
fix: correctly get auth token
Browse files Browse the repository at this point in the history
  • Loading branch information
Björn Urban committed Apr 30, 2024
1 parent cfbcf63 commit 8062218
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions backend/internal/handlers/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,16 +238,13 @@ func (h *Handler) logError(w http.ResponseWriter, message string, err error, sta
}

func (h *Handler) getUserEmailFromToken(r *http.Request) (string, error) {
cookie, err := r.Cookie("X-Auth-Token")
if err != nil {
slog.Error("Authentication Cookie missing")
return "", fmt.Errorf("Authentication cookie missing")
}
cookie := r.Header.Get("X-Auth-Token")
slog.Info("Token:", cookie)

tokenStr := cookie.Value
tokenStr := cookie
claims := &jwt.MapClaims{}

_, err = jwt.ParseWithClaims(tokenStr, claims, func(token *jwt.Token) (interface{}, error) {
_, err := jwt.ParseWithClaims(tokenStr, claims, func(token *jwt.Token) (interface{}, error) {
return h.JWTKey, nil
})

Expand Down

0 comments on commit 8062218

Please sign in to comment.