# @corbado/nodejs

> The Corbado Node.js library provides convenient access to the Corbado API from applications running on Node.js.

Latest version **1.1.9** (published 2023-06-06) · ISC license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @corbado/nodejs
pnpm add @corbado/nodejs
yarn add @corbado/nodejs
bun add @corbado/nodejs
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.1.9 |
| Published | 2023-06-06 |
| First published | 2023-06-02 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 30.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 109 |
| Author | Corbado |
| Maintainers | naetraga, vdelitz |
| Keywords | passkeys, authentication, webhooks, fido2 |

## Links

- npm: https://www.npmjs.com/package/@corbado/nodejs
- Repository: https://github.com/corbado/corbado-nodejs
- Homepage: https://github.com/corbado/corbado-nodejs#readme
- Issues: https://github.com/corbado/corbado-nodejs/issues
- npm.io page: https://npm.io/package/@corbado/nodejs

## Dependencies (3)

- [jose](https://npm.io/package/jose.md) ^4.14.4
- [axios](https://npm.io/package/axios.md) ^1.3
- [assert](https://npm.io/package/assert.md) ^2.0.0

## Alternatives

- [@clerk/clerk-expo](https://npm.io/package/@clerk/clerk-expo.md) — 133.6K weekly downloads
- [@pothos/plugin-authz](https://npm.io/package/@pothos/plugin-authz.md) — 12.4K weekly downloads
- [@bounded-sh/client](https://npm.io/package/@bounded-sh/client.md) — 3.2K weekly downloads
- [@luigi-project/plugin-auth-oauth2](https://npm.io/package/@luigi-project/plugin-auth-oauth2.md) — 2.3K weekly downloads
- [@nocobase/plugin-verification](https://npm.io/package/@nocobase/plugin-verification.md) — 2.0K weekly downloads

## Recent versions

- 1.1.9 (latest) — 2023-06-06
- 1.1.8 — 2023-06-06
- 1.1.7 — 2023-06-05
- 1.1.6 — 2023-06-05
- 1.1.5 — 2023-06-05
- 1.1.4 — 2023-06-05
- 1.1.3 — 2023-06-02
- 1.1.2 — 2023-06-02
- 1.1.1 — 2023-06-02
- 1.1.0 — 2023-06-02

## README

# Corbado Node.js library 

The Corbado Node.js library provides convenient access to the Corbado API from applications running on Node.js.

## Documentation 

See the [Corbado API Reference](https://api.corbado.com/docs/api/) and [Corbado API-only integration guide](https://docs.corbado.com/integrations/api-only) to understand the usage of Corbado API. 

## Requirements 

Node 8 or higher. 

## Installation 

```npm install @corbado/nodejs --save```


## Usage 

The package needs to be configured with your Corbado account's ```project ID``` and ```API secret```. All the parameters can be obtained from [Corbado developer panel](https://app.corbado.com). 

```project ID``` and ```API secret``` should be provided when initializing the Corbado module:


```
const Corbado = require('@corbado/nodejs');

const config = new Corbado.Configuration()
config.projectID = process.env.PROJECT_ID
config.apiSecret = process.env.API_SECRET

const corbado = new Corbado.SDK(config)

```

### Services 

Corbado provides several services, e.g. ```PasskeyService```, ```SessionService```, ```EmailLinkService``` or ```ShortSessionService```.
To access specific methods in, e.g. ```SessionService```, you can call:

```
corbado.session.verify(sessionToken, clientInfo);
```

### ShortSession

Short session service provides you an easy way of accessing our session v2 variant. 
It provides a validate method that returns a user object with all information about the current users state.
This state contains the current authentication state as well as users id, name, email and phone number.

```
const Corbado = require('@corbado/nodejs');

const config = new Corbado.Configuration()
config.projectID = process.env.PROJECT_ID
config.apiSecret = process.env.API_SECRET
config.authenticationURL = "https://" + config.projectID + '.auth.corbado.com'

const corbado = new Corbado.SDK(config)

const user = await corbado.shortSession.validate(req)
if (user.authenticated === true) {
    // Do anything with authenticated user
} else {
    // Perform login ceremony
}
```


### Utilities

Corbado package also provides several useful utility functions that can ease the development process, e.g.:
```
Corbado.getClientInfo(req);
```
helps to obtain relevant client information (```UserAgent```, ```RemoteAddress```, etc.) object from an ```HttpRequest```.

---
_Source: https://npm.io/package/@corbado/nodejs · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
