We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ff4c3da commit eb7bdc6Copy full SHA for eb7bdc6
1 file changed
playground/connect-next/app/(api)/connectToken/route.ts
@@ -0,0 +1,25 @@
1
+import { NextRequest } from 'next/server';
2
+import { getCorbadoConnectToken, verifyAmplifyToken } from '@/lib/utils';
3
+
4
+type Payload = {
5
+ idToken: string;
6
+ connectTokenType: string;
7
+};
8
9
+export async function POST(req: NextRequest) {
10
+ const body = (await req.json()) as Payload;
11
12
+ const { idToken, connectTokenType } = body;
13
14
+ const { displayName, identifier } = await verifyAmplifyToken(idToken);
15
16
+ const connectToken = await getCorbadoConnectToken(connectTokenType, {
17
+ displayName: displayName,
18
+ identifier: identifier,
19
+ });
20
21
+ return new Response(JSON.stringify({ token: connectToken }), {
22
+ status: 201,
23
+ headers: { 'Content-Type': 'application/json' },
24
25
+}
0 commit comments