Skip to content

Commit a015e1b

Browse files
authored
docs: Update Clerk example in middleware docs (#1754)
1. change `protect` usage to latest version 2. add locale prefix matcher and non locale prefix matcher at the same time to avoid infinite redirect Fixes #1458
1 parent 6e3304c commit a015e1b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/src/pages/docs/routing/middleware.mdx

+3-3
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,8 @@ const handleI18nRouting = createMiddleware(routing);
265265

266266
const isProtectedRoute = createRouteMatcher(['/:locale/dashboard(.*)']);
267267

268-
export default clerkMiddleware((auth, req) => {
269-
if (isProtectedRoute(req)) auth().protect();
268+
export default clerkMiddleware(async (auth, req) => {
269+
if (isProtectedRoute(req)) await auth.protect();
270270

271271
return handleI18nRouting(req);
272272
});
@@ -277,7 +277,7 @@ export const config = {
277277
};
278278
```
279279

280-
(based on `@clerk/nextjs@^5.0.0`)
280+
(based on `@clerk/nextjs@^6.0.0`)
281281

282282
### Example: Integrating with Supabase Authentication
283283

0 commit comments

Comments
 (0)