{"id":21590222,"url":"https://github.com/corbado/corbado-nodejs","last_synced_at":"2025-04-13T07:51:58.440Z","repository":{"id":144710911,"uuid":"533235501","full_name":"corbado/corbado-nodejs","owner":"corbado","description":"Add passkeys to your Node.js application with the Corbado Node.js SDK.","archived":false,"fork":false,"pushed_at":"2025-03-24T19:09:11.000Z","size":568,"stargazers_count":108,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-04T07:06:47.035Z","etag":null,"topics":["biometric","corbado","corbado-sdk","express","faceid","fido","fido2","nodejs","passkey","passkeys","sdk","touchid","webauthn"],"latest_commit_sha":null,"homepage":"https://www.corbado.com/passkeys/node-js","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/corbado.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-06T08:42:28.000Z","updated_at":"2025-03-26T08:32:37.000Z","dependencies_parsed_at":"2024-04-29T21:52:43.037Z","dependency_job_id":"30838dc8-2566-45a9-a20a-0c3fa549a302","html_url":"https://github.com/corbado/corbado-nodejs","commit_stats":{"total_commits":172,"total_committers":9,"mean_commits":19.11111111111111,"dds":0.7267441860465116,"last_synced_commit":"4f75f8536787c383b136ead15acae2f42737f915"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/corbado%2Fcorbado-nodejs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/corbado%2Fcorbado-nodejs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/corbado%2Fcorbado-nodejs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/corbado%2Fcorbado-nodejs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/corbado","download_url":"https://codeload.github.com/corbado/corbado-nodejs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248681493,"owners_count":21144700,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["biometric","corbado","corbado-sdk","express","faceid","fido","fido2","nodejs","passkey","passkeys","sdk","touchid","webauthn"],"created_at":"2024-11-24T16:17:10.422Z","updated_at":"2025-04-13T07:51:58.413Z","avatar_url":"https://github.com/corbado.png","language":"TypeScript","readme":"\u003cimg width=\"1070\" alt=\"GitHub Repo Cover\" src=\"https://github.com/corbado/corbado-php/assets/18458907/aa4f9df6-980b-4b24-bb2f-d71c0f480971\"\u003e\n\n# Corbado Node.js SDK\n\n[![License](https://img.shields.io/badge/license-MIT-green)](./LICENSE)\n![Latest Stable Version](https://img.shields.io/npm/v/@corbado/node-sdk)\n[![Coverage Status](https://github.com/corbado/corbado-nodejs/raw/gh-pages/badges/coverage-jest%20coverage.svg?raw=true)](https://nolleh.gitcorbado/corbado-nodejs/badges/coverage-jest%20coverage.svg?raw=true)\n[![codecov](https://codecov.io/gh/corbado/corbado-nodejs/graph/badge.svg?token=FD4TEXN6TR)](https://codecov.io/gh/corbado/corbado-nodejs)\n[![documentation](https://img.shields.io/badge/documentation-Corbado_Backend_API_Reference-blue.svg)](https://apireference.cloud.corbado.io/backendapi-v2/)\n[![Slack](https://img.shields.io/badge/slack-join%20chat-brightgreen.svg)](https://join.slack.com/t/corbado/shared_invite/zt-1b7867yz8-V~Xr~ngmSGbt7IA~g16ZsQ)\n\nThe [Corbado](https://www.corbado.com) Node SDK provides convenient access to the [Corbado Backend API](https://apireference.cloud.corbado.io/backendapi-v2/) from applications written in Node.js.\n\n[![integration-guides](https://github.com/user-attachments/assets/7859201b-a345-4b68-b336-6e2edcc6577b)](https://app.corbado.com/getting-started?search=typescript)\n\n: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.\n\n:rocket: [Getting started](#rocket-getting-started) | :hammer_and_wrench: [Installation](#installation) | :books: [Advanced](#books-advanced) | :speech_balloon: [Support \u0026 Feedback](#speech_balloon-support--feedback)\n\n## :rocket: Getting started\n\n### Requirements\n\n- Node.js 8 or higher.\n\n## Installation\n\nUse the following command to install the Corbado Node.js SDK:\n\n```bash\nnpm install @corbado/node-sdk\n```\n\n## Usage\n\nTo create a Node.js SDK instance you need to provide your `Project ID` and `API secret` which can be found at the [Developer Panel](https://app.corbado.com).\n\n### ES5:\n\n```JavaScript\nconst Corbado = require('@corbado/node-sdk');\n\nconst projectID = process.env.CORBADO_PROJECT_ID;\nconst apiSecret = process.env.CORBADO_API_SECRET;\nconst frontendAPI = process.env.CORBADO_FRONTEND_API;\nconst backendAPI = process.env.CORBADO_BACKEND_API;\n\nconst config = new Corbado.Config(projectID, apiSecret, frontendAPI, backendAPI);\nconst sdk = new Corbado.SDK(config);\n```\n\n### ES6:\n\n```JavaScript\nimport {SDK, Config} from '@corbado/node-sdk';\n\nconst projectID = process.env.CORBADO_PROJECT_ID;\nconst apiSecret = process.env.CORBADO_API_SECRET;\nconst frontendAPI = process.env.CORBADO_FRONTEND_API;\nconst backendAPI = process.env.CORBADO_BACKEND_API;\n\nconst config = new Config(projectID, apiSecret, frontendAPI, backendAPI);\nconst sdk = new SDK(config);\n```\n\n### See in action\n\n- Check [Next.js](https://github.com/corbado/passkeys-nextjs) example\n- Check [Express](https://github.com/corbado/passkeys-vuejs-express) example\n- Check [Hono](https://github.com/corbado/passkeys-react-hono) example\n- Check integration tests [here](tests/integration)\n\n### Services\n\nThe Corbado Node.js SDK provides the following services:\n\n- `sessions` for managing sessions ([examples](tests/unit/session.test.ts))\n- `identifiers` for managing identifiers ([examples](tests/integration/services/identifier.test.ts))\n- `users` for managing users ([examples](tests/integration/services/user.test.ts))\n\nTo use a specific service, such as `sessions`, invoke it as shown below:\n\n```JavaScript\ncorbado.sessions().validateToken(req);\n```\n\n## :books: Advanced\n\n### Error handling\n\nThe Corbado Node.js SDK throws exceptions for all errors. The following errors are thrown:\n\n- `BaseError` for failed assertions and configuration errors (client side)\n- `ServerError` for server errors (server side)\n\nIf the Backend API returns a HTTP status code other than 200, the Corbado Node.js SDK throws a `ServerError`. The `ServerError`class provides convenient methods to access all important data:\n\n```javascript\ntry {\n    // Try to get non-existing user with ID 'usr-123456789'\n    const user = sdk.users().get('usr-123456789');\n} catch (error: ServerError) {\n    // Show HTTP status code (404 in this case)\n    console.log(error.getHttpStatusCode());\n\n    // Show request ID (can be used in developer panel to look up the full request\n    // and response, see https://app.corbado.com/app/logs/requests)\n    console.log(error.getRequestID());\n\n    // Show full request data\n    console.log(error.getRequestData());\n\n    // Show runtime of request in seconds (server side)\n    console.log(error.getRuntime());\n\n    // Show validation error messages (server side validation in case of HTTP\n    // status code 400 (Bad Request))\n    console.log(error.getValidationMessages());\n\n    // Show full error data\n    console.log(error.getError());\n}\n```\n\n## :speech_balloon: Support \u0026 Feedback\n\n### Report an issue\n\nIf you encounter any bugs or have suggestions, please [open an issue](https://github.com/corbado/corbado-nodejs/issues/new).\n\n### Slack channel\n\nJoin our Slack channel to discuss questions or ideas with the Corbado team and other developers.\n\n[![Slack](https://img.shields.io/badge/slack-join%20chat-brightgreen.svg)](https://join.slack.com/t/corbado/shared_invite/zt-1b7867yz8-V~Xr~ngmSGbt7IA~g16ZsQ)\n\n### Email\n\nYou can also reach out to us via email at vincent.delitz@corbado.com.\n\n### Vulnerability reporting\n\nPlease report suspected security vulnerabilities in private to security@corbado.com. Please do NOT create publicly viewable issues for suspected security vulnerabilities.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcorbado%2Fcorbado-nodejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcorbado%2Fcorbado-nodejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcorbado%2Fcorbado-nodejs/lists"}