This is an SST + OpenAuth + Next.js project bootstrapped with create-next-app
.
This setup is slightly opinionated—TypeScript (+ the ESLint plugin) and Prettier (+ the TailwindCSS plugin) have been added,
based on the default configuration from create-next-app
.
Assuming you have your AWS credentials all set up, start the development server:
pnpm sst dev
Open http://localhost:3000 with your browser and click on "Sign in". This will navigate you to the OpenAuth authorizer Lambda function URL.
After registering, you can find your OTP in the SST multiplexed terminal.
src/auth/index.ts
- the AWS Lambda handler functionsrc/auth/client.ts
- the OpenAuth client definitionsrc/auth/subjects.ts
- your OpenAuth subject definitionsrc/app/actions.ts
- server actions for signing in, signing out, and checking if a user is authenticatedsrc/app/api/callback/route.ts
- the API route handler for OpenAuth to return to, and sets the access & refresh tokens
Important
You need to set the Auth
client function URL in src/auth/client.ts
after you have deployed with sst dev
or sst deploy
.