How to use AWS Amplify Authentication with Next.js Server Actions
No next-auth required:
// amplifyServerUtils.ts
import { createServerRunner } from '@aws-amplify/adapter-nextjs';
import config from '@/amplifyconfiguration.json';
export const { runWithAmplifyServerContext } = createServerRunner({
config
});
// actions.ts
"use server";
import { cookies } from "next/headers";