MIT License

项目介绍

corbado/corbado-nodejs 是一个托管在 GitHub 上的开源项目,主要使用 TypeScript 编写,采用 MIT License 许可证,目前获得 109 个 Star、2 次 Fork。

仓库全名
corbado/corbado-nodejs
开源许可证
MIT License
Star 数
109
Fork 数
2
未关闭 Issue
12

README 摘要

Corbado Node.js SDK The Corbado Node SDK provides convenient access to the Corbado Backend API from applications written in Node.js. :warning: 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…

完整内容见 GitHub 原始 README 或本页 。

常见问题

corbado-nodejs 用什么语言开发?

主要使用 TypeScript 编写,采用 MIT License 许可证,目前有 109 个 Star。

corbado-nodejs 可以免费商用吗?

仓库采用 MIT License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 corbado-nodejs 的源码?

可以直接克隆仓库:git clone https://github.com/corbado/corbado-nodejs.git;安装与运行步骤见仓库 README。

corbado-nodejs 最近还在维护吗?

仓库最近一次更新为 4月13日,当前有 12 个未关闭 Issue;Star 数为 109,可作为社区活跃度的参考。

关于

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

描述取自 GitHub 官方 API,中文内容由 GitRead 中文社区 编辑团队整理。

简要分析

热度分
222
价值分
76
活跃状态
归档

README

GitHub Repo Cover

Corbado Node.js SDK

License Latest Stable Version Coverage Status codecov documentation Slack

The Corbado Node SDK provides convenient access to the Corbado Backend API from applications written in Node.js.

integration-guides

:warning: 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.

:rocket: Getting started | :hammer_and_wrench: Installation | :books: Advanced | :speech_balloon: Support & Feedback

:rocket: 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 your Project ID and API secret which can be found at the Developer Panel.

ES5:

const Corbado = require('@corbado/node-sdk');

const projectID = process.env.CORBADO_PROJECT_ID;
const apiSecret = process.env.CORBADO_API_SECRET;
const frontendAPI = process.env.CORBADO_FRONTEND_API;
const backendAPI = process.env.CORBADO_BACKEND_API;

const config = new Corbado.Config(projectID, apiSecret, frontendAPI, backendAPI);
const sdk = new Corbado.SDK(config);

ES6:

import {SDK, Config} from '@corbado/node-sdk';

const projectID = process.env.CORBADO_PROJECT_ID;
const apiSecret = process.env.CORBADO_API_SECRET;
const frontendAPI = process.env.CORBADO_FRONTEND_API;
const backendAPI = process.env.CORBADO_BACKEND_API;

const config = new Config(projectID, apiSecret, frontendAPI, backendAPI);
const sdk = new SDK(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 as sessions, invoke it as shown below:

corbado.sessions().validateToken(req);

:books: 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 a ServerError. The ServerErrorclass provides convenient methods to access all important data:

try {
    // Try to get non-existing user with ID 'usr-123456789'
    const user = 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 data
    console.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 data
    console.log(error.getError());
}

:speech_balloon: Support & Feedback

Report an issue

If you encounter any bugs or have suggestions, please open 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 at [email protected].

Vulnerability reporting

Please report suspected security vulnerabilities in private to [email protected]. Please do NOT create publicly viewable issues for suspected security vulnerabilities.

评论

暂无评论