Skip to content

Commit

Permalink
fix(auth): missing path in cookie
Browse files Browse the repository at this point in the history
  • Loading branch information
Darkness4 committed Nov 23, 2023
1 parent e1f4fa3 commit d0f1bb6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ func (a *Auth) CallBack() http.HandlerFunc {
cookie := &http.Cookie{
Name: tokenCookieKey,
Value: token,
Path: "/",
Expires: time.Now().Add(jwt.ExpiresDuration),
HttpOnly: true,
}
Expand All @@ -141,6 +142,8 @@ func (a *Auth) Logout() http.HandlerFunc {
http.Redirect(w, r, "/", http.StatusSeeOther)
return
}
cookie.Value = ""
cookie.Path = "/"
cookie.Expires = time.Now().Add(-1 * time.Hour)
http.SetCookie(w, cookie)
http.Redirect(w, r, "/", http.StatusSeeOther)
Expand Down

0 comments on commit d0f1bb6

Please sign in to comment.