Merge pull request #25 from bknd-io/feat/node-media-local

Feat: Node media local
This commit is contained in:
dswbx
2024-12-23 11:44:40 +01:00
committed by GitHub
13 changed files with 206 additions and 124 deletions

View File

@@ -220,15 +220,23 @@ export class Authenticator<Strategies extends Record<string, Strategy> = Record<
}
private async getAuthCookie(c: Context): Promise<string | undefined> {
const secret = this.config.jwt.secret;
try {
const secret = this.config.jwt.secret;
const token = await getSignedCookie(c, secret, "auth");
if (typeof token !== "string") {
await deleteCookie(c, "auth", this.cookieOptions);
return undefined;
}
return token;
} catch (e: any) {
if (e instanceof Error) {
console.error("[Error:getAuthCookie]", e.message);
}
const token = await getSignedCookie(c, secret, "auth");
if (typeof token !== "string") {
await deleteCookie(c, "auth", this.cookieOptions);
return undefined;
}
return token;
}
async requestCookieRefresh(c: Context) {