refactor: update SetAuthCookie to use routeableApi.AuthTokenName()

This commit is contained in:
Derrick Hammer 2024-03-17 09:15:47 -04:00
parent 5861e95fb5
commit 675a583422
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 2 additions and 2 deletions

View File

@ -99,7 +99,7 @@ func JWTVerifyToken(token string, domain string, privateKey ed25519.PrivateKey,
return claim, err
}
func SetAuthCookie(jc jape.Context, token string, apiName string) {
func SetAuthCookie(jc jape.Context, apiName string) {
for name, api := range apiRegistry.GetAllAPIs() {
routeableApi, ok := api.(router.RoutableAPI)
if !ok {
@ -112,7 +112,7 @@ func SetAuthCookie(jc jape.Context, token string, apiName string) {
http.SetCookie(jc.ResponseWriter, &http.Cookie{
Name: name,
Value: token,
Value: routeableApi.AuthTokenName(),
Expires: time.Now().Add(24 * time.Hour),
Secure: true,
HttpOnly: true,