This example demonstrates how to query from GraphCMS NextAuth.js.
Users can login or register using the same form (for the purposes of this demo), and update their profile name/bio.
NextAuth.js has a REST API you should use to create custom login pages.
• Demo
You will need to create a Permanent Auth Token to use this example locally.
Inside of .env
add the following:
GRAPHCMS_ENDPOINT=
GRAPHCMS_TOKEN=
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=somethingsupersecret
You will need to set NEXTAUTH_URL
as your actual URL if deploying.
You will also need to follow instructions here to configure the models this project needs to work.
npx degit graphcms/graphcms-examples/with-nextauth-credentials with-nextauth-credentials
Install & Run:
cd with-nextauth-credentials
npm install
npm run dev
# or
cd with-nextauth-credentials
yarn
yarn dev