Skip to content

Commit

Permalink
chore(nextjs): Add changeset
Browse files Browse the repository at this point in the history
  • Loading branch information
anagstef committed Jun 7, 2023
1 parent fd6906e commit 0641a7c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .changeset/seven-mayflies-push.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
'@clerk/nextjs': minor
---

Return 401 Response on protected API routes. This change introduces a new apiRoutes param on authMiddleware.
If apiRoutes is omitted, then the following heuristic is used:
- If the route path is ['/api/(.*)', '/trpc/(.*)']
- or Request has Content-Type: application/json
- or Request method is not-GET,OPTIONS,HEAD,
then this is considered an API route.

After this commit, a 401 JSON Response is returned on the following 3 cases:
- When the authenticateRequest function returns the Unknown state.
- When the authenticateRequest function returns the Interstitial state and the route is an API route.
- When the user is signed out, the route is protected (not public), and the route is an API route. (this one happens inside our default implementation of afterAuth. If it is overwritten, then the user needs to handle this case themselves)

0 comments on commit 0641a7c

Please sign in to comment.