- Notifications
You must be signed in to change notification settings - Fork2
Add passkeys to your Node.js application with the Corbado Node.js SDK.
License
corbado/corbado-nodejs
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation

TheCorbado Node SDK provides convenient access to theCorbado Backend API from applications written in Node.js.
🚀Getting started | 🛠️Installation | 📚Advanced | 💬Support & Feedback
- Node.js 8 or higher.
Use the following command to install the Corbado Node.js SDK:
npm install @corbado/node-sdk
To create a Node.js SDK instance you need to provide yourProject ID andAPI secret which can be found at theDeveloper Panel.
constCorbado=require('@corbado/node-sdk');constprojectID=process.env.CORBADO_PROJECT_ID;constapiSecret=process.env.CORBADO_API_SECRET;constfrontendAPI=process.env.CORBADO_FRONTEND_API;constbackendAPI=process.env.CORBADO_BACKEND_API;constconfig=newCorbado.Config(projectID,apiSecret,frontendAPI,backendAPI);constsdk=newCorbado.SDK(config);
import{SDK,Config}from'@corbado/node-sdk';constprojectID=process.env.CORBADO_PROJECT_ID;constapiSecret=process.env.CORBADO_API_SECRET;constfrontendAPI=process.env.CORBADO_FRONTEND_API;constbackendAPI=process.env.CORBADO_BACKEND_API;constconfig=newConfig(projectID,apiSecret,frontendAPI,backendAPI);constsdk=newSDK(config);
The Corbado Node.js SDK provides the following services:
sessionsfor managing sessions (examples)identifiersfor managing identifiers (examples)usersfor managing users (examples)
To use a specific service, such assessions, invoke it as shown below:
corbado.sessions().validateToken(req);
The Corbado Node.js SDK throws exceptions for all errors. The following errors are thrown:
BaseErrorfor failed assertions and configuration errors (client side)ServerErrorfor server errors (server side)
If the Backend API returns a HTTP status code other than 200, the Corbado Node.js SDK throws aServerError. TheServerErrorclass provides convenient methods to access all important data:
try{// Try to get non-existing user with ID 'usr-123456789'constuser=sdk.users().get('usr-123456789');}catch(error:ServerError){// Show HTTP status code (404 in this case)console.log(error.getHttpStatusCode());// Show request ID (can be used in developer panel to look up the full request// and response, see https://app.corbado.com/app/logs/requests)console.log(error.getRequestID());// Show full request dataconsole.log(error.getRequestData());// Show runtime of request in seconds (server side)console.log(error.getRuntime());// Show validation error messages (server side validation in case of HTTP// status code 400 (Bad Request))console.log(error.getValidationMessages());// Show full error dataconsole.log(error.getError());}
If you encounter any bugs or have suggestions, pleaseopen an issue.
Join our Slack channel to discuss questions or ideas with the Corbado team and other developers.
You can also reach out to us via email atvincent.delitz@corbado.com.
Please report suspected security vulnerabilities in private tosecurity@corbado.com. Please do NOT create publicly viewable issues for suspected security vulnerabilities.
About
Add passkeys to your Node.js application with the Corbado Node.js SDK.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors8
Uh oh!
There was an error while loading.Please reload this page.
