- Go to Clerk and create a new application or use an existing one.
- On your application dashboard to to
API Key
- Use the
Quick Copy
for Next.js and copy the.env.local
- Create a new
.env.local
file in the root folder (next to thepackage.json
) - Paste the credentials into the
.env.local
file - Go to
JWT Templates
and create a newBlank
template - Name it
wundergraph
- Use the following template: (You can also include other claims as needed)
{
"id": "{{user.id}}",
"email": "{{user.primary_email_address}}",
"lastName": "{{user.last_name}}",
"username": "{{user.username}}",
"firstName": "{{user.first_name}}"
}
- Copy the JWKS Endpoint url
- Add a new environment variable to
.env.local
calledCLERK_JWKS_URL
and paste the url as the value
- Install the dependencies and run the complete example in one command:
npm install && npm start
On the NextJS frontend, click the "Login" button. Once the login is complete, the Frontend will automatically fetch the data and inject the bearer token into the origin request.
Join us on Discord!