Skip to content

Commit

Permalink
FR-15071 - Rewrite cookies on failure request to support Microsoft SS…
Browse files Browse the repository at this point in the history
…O activation process (#313)
  • Loading branch information
frontegg-david authored Jan 29, 2024
1 parent 8016655 commit 6088150
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/nextjs/src/middleware/ProxyResponseCallback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,8 @@ const ProxyResponseCallback: ProxyResCallback<IncomingMessage, NextApiResponse>
return;
}

const cookies = CookieManager.modifySetCookie(proxyRes.headers['set-cookie'], isSecured) ?? [];
if (isSuccess) {
const cookies = CookieManager.modifySetCookie(proxyRes.headers['set-cookie'], isSecured) ?? [];

try {
if (bodyStr && bodyStr.length > 0) {
const body = JSON.parse(bodyStr);
Expand Down Expand Up @@ -101,6 +100,7 @@ const ProxyResponseCallback: ProxyResCallback<IncomingMessage, NextApiResponse>
.forEach((header) => {
res.setHeader(header, `${proxyRes.headers[header]}`);
});
res.setHeader('set-cookie', cookies);
res.status(statusCode).end(bodyStr);
}
} catch (e: any) {
Expand Down

0 comments on commit 6088150

Please sign in to comment.