forked from auth0/nextjs-auth0
-
Notifications
You must be signed in to change notification settings - Fork 0
/
page.tsx
27 lines (25 loc) · 818 Bytes
/
page.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import React from 'react';
import { getSession, withPageAuthRequired } from '@auth0/nextjs-auth0';
import ServerComponent from '@/app/server-component';
import ClientComponent from '@/app/client-component';
export default withPageAuthRequired(
async function Page() {
const session = await getSession();
return (
<main>
<h1>Profile</h1>
<h2>Page:</h2>
<h3>Access Token</h3>
<pre>{JSON.stringify({ accessToken: session?.accessToken }, null, 2)}</pre>
<h3>User</h3>
<pre>{JSON.stringify(session?.user, null, 2)}</pre>
<h2>Server Component:</h2>
{/*@ts-expect-error Async Server Component*/}
<ServerComponent />
<h2>Client Component:</h2>
<ClientComponent />
</main>
);
},
{ returnTo: '/profile' }
);