Dashboard
Logged in as: {auth.data.email}
MFA status: {auth.data.aal === 'aal2' ? 'Verified' : 'Not verified'}
);
}
```
### Response
#### Success Response (200)
- **data** (object) - User authentication data including email and MFA status.
- **error** (null) - Indicates no error occurred.
#### Error Response
- **data** (null) - No user data.
- **error** (object) - Error object.
- **redirectTo** (string) - URL to redirect to for authentication.
#### Response Example
```json
{
"data": {
"email": "user@example.com",
"aal": "aal2"
},
"error": null,
"redirectTo": null
}
```
```json
{
"data": null,
"error": {
"message": "User not authenticated"
},
"redirectTo": "/sign-in"
}
```
```
--------------------------------
### Authenticate Server Components with requireUser
Source: https://context7.com/makerkit/documentation/llms.txt
Use requireUser to verify authentication and MFA status in Server Components, Server Actions, or Route Handlers. It returns user data or handles redirection for unauthenticated requests.
```tsx
import { redirect } from 'next/navigation';
import { requireUser } from '@kit/supabase/require-user';
import { getSupabaseServerClient } from '@kit/supabase/server-client';
export default async function DashboardPage() {
const client = getSupabaseServerClient();
const auth = await requireUser(client);
if (auth.error) {
redirect(auth.redirectTo);
}
return (
Loading...
;
}
return (
Loading...
;
}
return (