Skip to content

Commit

Permalink
fix: disable cookie auth for non GET requests
Browse files Browse the repository at this point in the history
  • Loading branch information
o1egl committed Jul 18, 2022
1 parent cb43770 commit 80030de
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions http/auth.go
Expand Up @@ -53,9 +53,11 @@ func (e extractor) ExtractToken(r *http.Request) (string, error) {
return auth, nil
}

cookie, _ := r.Cookie("auth")
if cookie != nil && strings.Count(cookie.Value, ".") == 2 {
return cookie.Value, nil
if r.Method == http.MethodGet {
cookie, _ := r.Cookie("auth")
if cookie != nil && strings.Count(cookie.Value, ".") == 2 {
return cookie.Value, nil
}
}

return "", request.ErrNoTokenInRequest
Expand Down

0 comments on commit 80030de

Please sign in to comment.