-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DEVREL-990 Rework auth handling in middleware to allow unauthenticate…
…d requests outside preview mode
- Loading branch information
Showing
5 changed files
with
41 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
export const envIdCookieName = "currentEnvId"; | ||
|
||
export const previewApiKeyCookieName = "currentPreviewApiKey"; | ||
|
||
export const ignoreMissingApiKeyCookieName = "ignoreMissingApiKey"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,12 @@ | ||
import { NextApiHandler } from "next"; | ||
|
||
import { ignoreMissingApiKeyCookieName } from "../../lib/constants/cookies"; | ||
|
||
const handler: NextApiHandler = (req, res) => { | ||
// Exit the current user from "Preview Mode". This function accepts no args. | ||
res.clearPreviewData(); | ||
|
||
res.setHeader("Set-Cookie", `${ignoreMissingApiKeyCookieName}=; Path=/; SameSite=None; Secure; Max-Age=-1`); | ||
|
||
// Redirect the user back to the index page. | ||
// Might be implemented return URL by the query string. | ||
res.redirect(typeof req.query.callback === "string" ? req.query.callback : "/"); | ||
res.redirect(req.query.callback && typeof req.query.callback === "string" ? req.query.callback : "/"); | ||
} | ||
|
||
export default handler; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
001994b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
ficto-imaging-qa – ./
ficto-imaging-qa.vercel.app
ficto-imaging-qa-git-main-kontent-ai-devrel.vercel.app
ficto-imaging-qa-kontent-ai-devrel.vercel.app
001994b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
ficto-surgical-qa – ./
ficto-surgical-qa.vercel.app
ficto-surgical-qa-kontent-ai-devrel.vercel.app
ficto-surgical-qa-git-main-kontent-ai-devrel.vercel.app
001994b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
ficto-imaging – ./
ficto-imaging-kontent-ai-devrel.vercel.app
ficto-imaging.vercel.app
ficto-imaging-git-main-kontent-ai-devrel.vercel.app
001994b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
ficto-healthtech – ./
ficto-healthtech-git-main-kontent-ai-devrel.vercel.app
ficto-healthtech-kontent-ai-devrel.vercel.app
ficto-healthtech.vercel.app
001994b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
ficto-healthtech-qa – ./
ficto-healthtech-qa-git-main-kontent-ai-devrel.vercel.app
ficto-healthtech-qa.vercel.app
ficto-healthtech-qa-kontent-ai-devrel.vercel.app