![GitHub Repo Cover](https://private-user-images.githubusercontent.com/18458907/291711345-aa4f9df6-980b-4b24-bb2f-d71c0f480971.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0MjU4NzQsIm5iZiI6MTczOTQyNTU3NCwicGF0aCI6Ii8xODQ1ODkwNy8yOTE3MTEzNDUtYWE0ZjlkZjYtOTgwYi00YjI0LWJiMmYtZDcxYzBmNDgwOTcxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEzVDA1NDYxNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTExOGU4YWUyZGU2NDJkMDY1NDU0NmQxZTkzMjhjNTc2MjQ2MjVmYWRlMjQ0OTE3ZmQ2NzNmNTEwODFhNThmOTEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.RexEDgb3T8Dz6GRsldLiTn8uKt5JX6V7v_apHfsdJK4)
This is a sample implementation of the Corbado passkeys-first authentication solution using Next.js with TypeScript. The following packages are being used:
app/auth/page.tsx
: the file where the React Auth component is usedapp/profile/page.tsx
: displays user information if the user has successfully authenticated (rendered on the server)app/user-data/route.ts
: api route that checks the users authentication state using the Corbado Node SDKapp/page.tsx
: client rendered page that accesses data from the above mentioned route.env.local
: add relevant environment variables that you can obtain from Corbado developer panel
Please follow the steps in Getting started to create and configure a project in the Corbado developer panel.
You need to have Node and npm
installed to run it.
Use the values you obtained in Prerequisites to configure the following variables inside a .env
file you create in the root folder of this project:
NEXT_PUBLIC_CORBADO_PROJECT_ID=pro-XXX
CORBADO_API_SECRET=corbado1_XXX
CORBADO_FRONTEND_API=https://${CORBADO_PROJECT_ID}.frontendapi.cloud.corbado.io
CORBADO_BACKEND_API=https://backendapi.cloud.corbado.io
Run
npm i
to install all dependencies.
Finally, you can run the project locally with
npm run dev
- Community for Developer Support: https://bit.ly/passkeys-community
- Passkeys Debugger: https://www.passkeys-debugger.io/
- Passkey Subreddit: https://www.reddit.com/r/passkey/