Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix Force MFA Guide #1834

Merged
merged 12 commits into from
Jan 8, 2025
Prev Previous commit
Next Next commit
fix async
jacekradko committed Oct 22, 2024
commit 5391c1e5245a9a1307b4d25df1be30f9d3a884ab
2 changes: 1 addition & 1 deletion docs/guides/force-organizations.mdx
Original file line number Diff line number Diff line change
@@ -238,7 +238,7 @@ This guide will be written for Next.js applications using App Router, but the sa
```tsx {{ filename: 'middleware.ts' }}
import { clerkMiddleware } from '@clerk/nextjs/server'

export default async clerkMiddleware((auth, req) => {
export default clerkMiddleware(async (auth, req) => {
const { userId, orgId } = await auth()

// Redirect signed in users to organization selection page if they are not active in an organization
2 changes: 1 addition & 1 deletion docs/references/nextjs/auth.mdx
Original file line number Diff line number Diff line change
@@ -196,7 +196,7 @@ You can protect certain parts of your application or even entire routes based on
```tsx {{ filename: 'app/api/create-team/route.ts' }}
import { auth } from '@clerk/nextjs/server'

export async const POST = () => {
export const POST = async () => {
const { userId } = await auth.protect({ permission: 'org:team_settings:manage' })

return users.createTeam(userId)
4 changes: 2 additions & 2 deletions docs/references/nextjs/server-actions.mdx
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ export default function AddToCart() {
async function addItem(formData: FormData) {
'use server'

const { userId } = auth()
const { userId } = await auth()

if (!userId) {
throw new Error('You must be signed in to add an item to your cart')
@@ -87,7 +87,7 @@ Use the following tabs to see an example of how to protect a Server Action that
import { auth } from '@clerk/nextjs/server'

export async function addItem(formData: FormData) {
const { userId } = auth()
const { userId } = await auth()

if (!userId) {
throw new Error('You must be signed in to add an item to your cart')