Skip to content

Commit

Permalink
optional cookie domain
Browse files Browse the repository at this point in the history
  • Loading branch information
hubsmoke committed Nov 9, 2023
1 parent f987ef8 commit 6f8d596
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion desci-server/src/controllers/auth/logout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const logout = async (req: Request, res: Response, next: NextFunction) =>
sameSite: 'strict',
});

(process.env.COOKIE_DOMAIN.split(',') || [undefined]).map((domain) => {
(process.env.COOKIE_DOMAIN?.split(',') || [undefined]).map((domain) => {
res.clearCookie('auth', {
maxAge: oneYear,
httpOnly: true, // Ineffective whilst we still return the bearer token to the client in the response
Expand Down
2 changes: 1 addition & 1 deletion desci-server/src/utils/sendCookie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { oneDay, oneYear } from 'controllers/auth';
import logger from 'logger';
export const sendCookie = (res: Response, token: string, isDevMode: boolean) => {
if (!isDevMode) {
(process.env.COOKIE_DOMAIN.split(',') || [undefined]).map((domain) => {
(process.env.COOKIE_DOMAIN?.split(',') || [undefined]).map((domain) => {
res.cookie('auth', token, {
maxAge: oneYear,
httpOnly: true, // Ineffective whilst we still return the bearer token to the client in the response
Expand Down

0 comments on commit 6f8d596

Please sign in to comment.