Skip to content

Commit

Permalink
fix: set the domain for cookies (#66)
Browse files Browse the repository at this point in the history
This should allow the unteris.com domain to send the cookies to
api.unteris.com
  • Loading branch information
jmcdo29 authored Sep 27, 2023
2 parents 31910ef + 6e98450 commit ebb4985
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion libs/server/session/src/lib/session.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,14 @@ import { RedisClientType } from "redis";

@Injectable()
export class ServerSessionService {
private readonly domain: string;
constructor(
private readonly tokenService: ServerTokenService,
@InjectRedisInstance() private readonly redis: RedisClientType,
private readonly config: ServerConfigService,
) {}
) {
this.domain = new URL(config.get("CORS")).host;
}

async createSessionId() {
return this.tokenService.generateToken(128);
Expand Down Expand Up @@ -116,6 +119,7 @@ export class ServerSessionService {
httpOnly: true,
path: "/api",
sameSite: "Strict" as const,
domain: this.domain,
...options,
},
};
Expand Down

0 comments on commit ebb4985

Please sign in to comment.