Skip to content

Commit 7869f75

Browse files
committed
move clerkclient init outside of request
1 parent 2f1c963 commit 7869f75

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

docs/_partials/authenticate-req.mdx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,15 @@
8383
```tsx
8484
import { createClerkClient } from '@clerk/backend'
8585

86-
export async function GET(req: Request) {
87-
// Initialize the JS Backend SDK
88-
// This varies depending on the SDK you're using
89-
// https://clerk.com/docs/js-backend/getting-started/quickstart
90-
const clerkClient = createClerkClient({
91-
secretKey: process.env.CLERK_SECRET_KEY,
92-
publishableKey: process.env.CLERK_PUBLISHABLE_KEY,
93-
})
86+
// Initialize the JS Backend SDK
87+
// This varies depending on the SDK you're using
88+
// https://clerk.com/docs/js-backend/getting-started/quickstart
89+
const clerkClient = createClerkClient({
90+
secretKey: process.env.CLERK_SECRET_KEY,
91+
publishableKey: process.env.CLERK_PUBLISHABLE_KEY,
92+
})
9493

94+
export async function GET(req: Request) {
9595
// Use the `authenticateRequest()` method to verify the token
9696
const { isAuthenticated } = await clerkClient.authenticateRequest(req, {
9797
authorizedParties: ['https://example.com'],

0 commit comments

Comments
 (0)