This commit is contained in:
parent
c53f2bfbc9
commit
4a1f943339
@ -118,18 +118,18 @@ export class AuthService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getCookieOptions(isRefreshToken = false) {
|
getCookieOptions(isRefreshToken = false) {
|
||||||
// const isProduction =
|
const isProduction =
|
||||||
// this.configService.get<string>("NODE_ENV") === "production";
|
this.configService.get<string>("NODE_ENV") === "production";
|
||||||
// const cookieSecure =
|
const cookieSecure =
|
||||||
// this.configService.get<string>("COOKIE_SECURE") === "true";
|
this.configService.get<string>("COOKIE_SECURE") === "true";
|
||||||
// const domain = this.configService.get<string>("COOKIE_DOMAIN");
|
const domain = this.configService.get<string>("COOKIE_DOMAIN");
|
||||||
|
|
||||||
return {
|
return {
|
||||||
httpOnly: true,
|
httpOnly: true,
|
||||||
// secure: isProduction || cookieSecure,
|
secure: true,
|
||||||
sameSite: "none" as const,
|
sameSite: "none" as const,
|
||||||
path: isRefreshToken ? "/auth/refresh" : "/",
|
path: isRefreshToken ? "/auth/refresh" : "/",
|
||||||
// domain: domain,
|
domain: domain,
|
||||||
maxAge: isRefreshToken ? 7 * 24 * 60 * 60 * 1000 : 15 * 60 * 1000,
|
maxAge: isRefreshToken ? 7 * 24 * 60 * 60 * 1000 : 15 * 60 * 1000,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
21
src/main.ts
21
src/main.ts
@ -12,8 +12,25 @@ async function bootstrap() {
|
|||||||
app.enableCors({
|
app.enableCors({
|
||||||
origin: corsOrigins,
|
origin: corsOrigins,
|
||||||
credentials: true,
|
credentials: true,
|
||||||
methods: ["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"],
|
allowedHeaders: [
|
||||||
allowedHeaders: ["Content-Type", "Authorization", "X-Requested-With"],
|
"Content-Type",
|
||||||
|
"Authorization",
|
||||||
|
"X-Requested-With",
|
||||||
|
"Accept",
|
||||||
|
"Origin",
|
||||||
|
"Access-Control-Request-Method",
|
||||||
|
"Access-Control-Request-Headers",
|
||||||
|
"Cache-Control",
|
||||||
|
],
|
||||||
|
exposedHeaders: [
|
||||||
|
"Authorization",
|
||||||
|
"Set-Cookie",
|
||||||
|
"Access-Control-Allow-Origin",
|
||||||
|
"Access-Control-Allow-Credentials",
|
||||||
|
],
|
||||||
|
preflightContinue: false,
|
||||||
|
optionsSuccessStatus: 204,
|
||||||
|
maxAge: 86400, // 24 hours
|
||||||
});
|
});
|
||||||
|
|
||||||
app.use(cookieParser());
|
app.use(cookieParser());
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user