Node/Express APIs

These instructions assume you already have a Kinde account. You can register for free here (no credit card required).

This guide details how to protect your GraphQL endpoints, when running on ExpressJS.

It assumes you already have a frontend connected to Kinde which is sending a Kinde issued bearer token to your API for verification.

If you don’t yet have a frontend setup, please set this up first following the relevant guide:




Configure Express

Add Kinde Express Middleware as a dependency

The easiest way to install the middleware is via npm:

npm i @kinde-oss/kinde-node-express-api


If you would like to use our Environments feature as part of your development process. You will need to create them first within your Kinde account, see the guide here. In this case you would use the Environment subdomain in the code block above.

Integrate with your app

Import the middleware as you would any other Node package - we recommend you do this in you app.js or index.js file depending on your structure.

const kindeAuthExpress = require("@kinde-oss/kinde-node-express-api");


In the same file after any other imports initialize the library by entering your Kinde domain. This grabs the verification keys for your app.

let authenticate;
(async () => {
    authenticate = await kindeAuthExpress(YOUR_KINDE_DOMAIN);


Any api routes you wish to protect you can now pass the authenticate middleware to. This will verify if the Bearer token sent with the api call matches the keys on your domain and prevent access to unauthorized users.

app.get("/api/me", authenticate);

If a user is not authorized the server will return a 401 Not Authorized response.


If the user was authorized their Kinde id is added to the request object which you can access as follows

app.get("/api/me", authenticate, (req, res) => {

If you need any assistance with getting Kinde connected reach out to us at

Get more support

See Kinde in action

Find out what Kinde can do in a live demo with one of our experts.

Book a demo

Talk to us

If you can’t find what you’re looking for in our help center - email our team. We’d love to hear from you.

Contact support
Talk to us