Skip to content

Commit

Permalink
fix: check for heimdall token availability
Browse files Browse the repository at this point in the history
  • Loading branch information
proffapt committed Jun 29, 2024
1 parent cde4e01 commit be40d7e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions backend/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ func PasswordGenerator(passwordLength int) string {
}

func register(res http.ResponseWriter, req *http.Request) {
cookie, _ := req.Cookie("heimdall")
// It won't throw any error.
// The service will be protected by heimdall
// Hence if this endpoint is being triggered then
// It means that cookie has to be present
cookie, err := req.Cookie("heimdall")
if err != nil {
http.Error(res, "No Heimdall session token received", http.StatusUnauthorized)
return
}
tokenString := cookie.Value

// Get email from JWT
Expand Down

0 comments on commit be40d7e

Please sign in to comment.