Node/Express GraphQL

If your Graph runs on Node / Express you can use our NodeJS SDK to secure your resolvers and check that the user is authorized to access them.

Configure Express

Add Kinde Node as a dependency

The easiest way to install the middleware is via npm:

npm i @kinde-oss/kinde-node

Integrate with your app

Import 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 kindeNode = require("@kinde-oss/kinde-node");


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 kindeNode(YOUR_KINDE_DOMAIN);


We recommend you create a context for holding contextual data and use our authenticate function to verify if the Bearer token sent with the api call matches the keys on your domain and prevent access to unauthorized users.

const context = (req) => {
    const user = new Promise((resolve, reject) => {
        authenticate(req, (err, user) => {
            if (err) {
                return reject(err);

    return {


It’s pretty common that a Graph will have a mix of public and private fields.

Because we’ve added the user to context we can access this in the individual field resolvers and decide what to return.

As an example, this resolver is only accessible with a valid user:

users: (args, context) => {
    // In this case, we’ll pretend there is no data when
    // we’re not logged in. Another option would be to
    // throw an error

    if (!context.user) return null;
    return ["bob", "jake"];

Get more support

Help center

Start here - our help center has everything you need to get started and answer many commonly asked questions.

Visit our help center

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