Skip to content

Commit bc9717b

Browse files
committed
fix: add console logs for token expiration and cookie format in AdminForthAuth
1 parent 83040a3 commit bc9717b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

adminforth/auth.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,21 @@ class AdminForthAuth implements IAdminForthAuth {
8282
username: string,
8383
pk: string | null
8484
}) {
85+
console.log("in days", expireInDays);
8586
const expiresIn: string = expireInDays ? `${expireInDays}d` : (process.env.ADMINFORTH_AUTH_EXPIRESIN || '24h');
87+
console.log("in string", expiresIn);
8688
// might be h,m,d in string
89+
8790
const expiresInSec = parseTimeToSeconds(expiresIn);
8891

92+
console.log("expiresInSec", expiresInSec);
93+
8994
const token = this.issueJWT({ username, pk}, 'auth', expiresIn);
95+
console.log("token", token);
9096
const expiresCookieFormat = new Date(Date.now() + expiresInSec * 1000).toUTCString();
91-
97+
console.log("expiresCookieFormat", expiresCookieFormat);
9298
const brandSlug = this.adminforth.config.customization.brandNameSlug;
99+
console.log("brandSlug", brandSlug);
93100
response.setHeader('Set-Cookie', `adminforth_${brandSlug}_jwt=${token}; Path=${this.adminforth.config.baseUrl || '/'}; HttpOnly; SameSite=Strict; Expires=${expiresCookieFormat}`);
94101
}
95102

0 commit comments

Comments
 (0)