Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add passkeys to your Node.js application with the Corbado Node.js SDK.

License

NotificationsYou must be signed in to change notification settings

corbado/corbado-nodejs

Repository files navigation

GitHub Repo Cover

Corbado Node.js SDK

LicenseLatest Stable VersionCoverage StatuscodecovdocumentationSlack

TheCorbado Node SDK provides convenient access to theCorbado Backend API from applications written in Node.js.

integration-guides

⚠️ The Corbado Node.js SDK 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.

🚀Getting started | 🛠️Installation | 📚Advanced | 💬Support & Feedback

🚀 Getting started

Requirements

  • Node.js 8 or higher.

Installation

Use the following command to install the Corbado Node.js SDK:

npm install @corbado/node-sdk

Usage

To create a Node.js SDK instance you need to provide yourProject ID andAPI secret which can be found at theDeveloper Panel.

ES5:

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);

ES6:

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);

See in action

Services

The Corbado Node.js SDK provides the following services:

  • sessions for managing sessions (examples)
  • identifiers for managing identifiers (examples)
  • users for managing users (examples)

To use a specific service, such assessions, invoke it as shown below:

corbado.sessions().validateToken(req);

📚 Advanced

Error handling

The Corbado Node.js SDK throws exceptions for all errors. The following errors are thrown:

  • BaseError for failed assertions and configuration errors (client side)
  • ServerError for 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());}

💬 Support & Feedback

Report an issue

If you encounter any bugs or have suggestions, pleaseopen an issue.

Slack channel

Join our Slack channel to discuss questions or ideas with the Corbado team and other developers.

Slack

Email

You can also reach out to us via email atvincent.delitz@corbado.com.

Vulnerability reporting

Please report suspected security vulnerabilities in private tosecurity@corbado.com. Please do NOT create publicly viewable issues for suspected security vulnerabilities.

Releases

No releases published

Packages

No packages published

Contributors8

Languages


[8]ページ先頭

©2009-2025 Movatter.jp