Links

Node.js SDK (Express)

Corbado provides you with a Node.js (Express) SDK that eases the integration.

Overview

To proceed with the following steps, you will require your project ID and API secret. If you don't have this information yet, please follow steps 1-3 of the Getting Started guide.
The Node.js SDK (Express) is commonly referred to as a private client, specifically designed for usage within closed backend applications. This particular SDK should exclusively be utilized in such environments, as it is crucial to ensure that the API secret remains strictly confidential and is never shared.

Installation

The Node.js SDK is hosted on GitHub. You can install it via npm:
npm install @corbado/node-sdk --save
Now, you can create an instance of the Node.js SDK:

Instantiation

ES5

1
const Corbado = require('@corbado/node-sdk');
2
3
const config = new Corbado.Configuration(<project ID>, <API secret>);
4
const corbado = new Corbado.SDK(config);

ES6

1
import {SDK, Configuration} from '@corbado/node-sdk';
2
3
const config = new Configuration(<project ID>, <API secret>);
4
const corbado = new SDK(config);

Instantiation with webhooks

If you have existing users and need webhooks to communicate with them, please add the webhook username and password to the config:

ES5

1
const Corbado = require('@corbado/node-sdk');
2
3
const config = new Corbado.Configuration(<project ID>, <API secret>);
4
config.webhookUsername = <webhook username>;
5
config.webhookPassword = <webhook password>;
6
const corbado = new Corbado.SDK(config);

ES6

1
import {SDK, Configuration} from '@corbado/node-sdk';
2
3
const config = new Configuration(<project ID>, <API secret>);
4
config.webhookUsername = <webhook username>;
5
config.webhookPassword = <webhook password>;
6
const corbado = new SDK(config);

Instantiation to go live with CNAME

If you want to go live with an own CNAME, you need to update the Frontend API URL to be your CNAME in order to avoid JWT claim errors with the iss JWT claim:

ES5

1
const Corbado = require('@corbado/node-sdk');
2
3
const config = new Corbado.Configuration(<project ID>, <API secret>);
4
config.frontendAPI = <CNAME>;
5
const corbado = new Corbado.SDK(config);

ES6

1
import {SDK, Configuration} from '@corbado/node-sdk';
2
3
const config = new Configuration(<project ID>, <API secret>);
4
config.frontendAPI = <CNAME>;
5
const corbado = new SDK(config);