refactor: switch to using MaxAge

This commit is contained in:
Derrick Hammer 2024-03-20 17:13:13 -04:00
parent 9587ef4941
commit ad8de8f5a1
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 2 additions and 2 deletions

View File

@ -119,7 +119,7 @@ func SetAuthCookie(jc jape.Context, jwt string, apiName string) {
http.SetCookie(jc.ResponseWriter, &http.Cookie{ http.SetCookie(jc.ResponseWriter, &http.Cookie{
Name: routeableApi.AuthTokenName(), Name: routeableApi.AuthTokenName(),
Value: jwt, Value: jwt,
Expires: time.Now().Add(24 * time.Hour), MaxAge: int((24 * time.Hour).Seconds()),
Secure: true, Secure: true,
HttpOnly: true, HttpOnly: true,
Path: "/", Path: "/",
@ -166,7 +166,7 @@ func EchoAuthCookie(jc jape.Context, apiName string) {
http.SetCookie(jc.ResponseWriter, &http.Cookie{ http.SetCookie(jc.ResponseWriter, &http.Cookie{
Name: cookies[0].Name, Name: cookies[0].Name,
Value: cookies[0].Value, Value: cookies[0].Value,
Expires: exp.Time, MaxAge: int(exp.Time.Sub(time.Now()).Seconds()),
Secure: true, Secure: true,
HttpOnly: true, HttpOnly: true,
Path: "/", Path: "/",