refactor: switch to using MaxAge
This commit is contained in:
parent
9587ef4941
commit
ad8de8f5a1
|
@ -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: "/",
|
||||||
|
|
Loading…
Reference in New Issue