# idtoken-verifier

> A lightweight library to decode and verify RS JWT meant for the browser.

Latest version **2.2.4** (published 2023-10-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install idtoken-verifier
pnpm add idtoken-verifier
yarn add idtoken-verifier
bun add idtoken-verifier
```

## Health

**Score 50/100 (C)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; has provenance; high maintenance score; high quality score.

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 2.2.4 |
| Published | 2023-10-27 |
| First published | 2016-12-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 6 |
| Unpacked size | 990.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 77 |
| Author | Auth0 |
| Maintainers | ncluer, vic-dev, enriquepina, ece-okta, pubalokta, dougmiller-okta, zak.nour, stheller, jamescgarrett-okta, madhuri.rm23, willvedd, david.renaud.okta, jeff.shuman, auth0-oss, codepete, ziluvatar, iaco, cocojoe, auth0npm, auth0brokkr, hzalaz, aaguiarz, charlesrea, lbalmaceda, julien.wollscheid, cristiandouce, sambego, stevehobbsdev, sandrinodimattia, lzychowski, joshcanhelp, rob.coles, rosnovsky, davidpatrick0, widcket, adamjmcgrath, jim.andersoon, frederikprijck, sergii.biienko, tomauth0, jpadilla, jessele, rhamzeh_auth0, greglopez, glena, damieng, auth0alec |
| Keywords | auth0, auth, authentication, jwt, verification, RS256, browser |

## Links

- npm: https://www.npmjs.com/package/idtoken-verifier
- Repository: https://github.com/auth0/idtoken-verifier
- Homepage: https://github.com/auth0/idtoken-verifier#readme
- Issues: https://github.com/auth0/idtoken-verifier/issues
- npm.io page: https://npm.io/package/idtoken-verifier

## Dependencies (6)

- [jsbn](https://npm.io/package/jsbn.md) ^1.1.0
- [unfetch](https://npm.io/package/unfetch.md) ^4.2.0
- [url-join](https://npm.io/package/url-join.md) ^4.0.1
- [base64-js](https://npm.io/package/base64-js.md) ^1.5.1
- [crypto-js](https://npm.io/package/crypto-js.md) ^4.2.0
- [es6-promise](https://npm.io/package/es6-promise.md) ^4.2.8

## 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

- 2.2.4 (latest) — 2023-10-27
- 2.2.3 — 2023-02-06
- 2.2.2 — 2021-10-15
- 2.2.1 — 2021-08-24
- 2.2.0 — 2021-06-18
- 2.1.2 — 2021-05-26
- 2.1.1 — 2021-05-25
- 2.1.0 — 2020-09-11
- 2.0.3 — 2020-04-24
- 2.0.2 — 2020-02-20
- 2.0.1 — 2020-01-13
- 2.0.0 — 2019-12-06
- 1.5.1 — 2019-12-06
- 1.5.0 — 2019-12-05
- 1.4.1 — 2019-07-10
- … 11 more at https://npm.io/package/idtoken-verifier/versions

## README

![idtoken-verifier](https://cdn.auth0.com/website/sdks/banners/idtoken-verifier-banner.png)

A lightweight library to decode and verify RSA ID tokens meant for the browser.

[![Build Status][circleci-image]][circleci-url]
[![NPM version][npm-image]][npm-url]
[![Coverage][codecov-image]][codecov-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]

:books: [Documentation](#documentation) - :rocket: [Getting Started](#getting-started) - :computer: [API Reference](#api-reference) - :speech_balloon: [Feedback](#feedback)

## Documentation

- [API Reference](https://auth0.github.io/idtoken-verifier)
- [Docs Site](https://auth0.com/docs) - explore our Docs site and learn more about Auth0

## Getting Started

### Installation

Using [npm](https://npmjs.org/) in your project directory run the following command:

```
npm install idtoken-verifier
```

### Verify an ID token

Import the library, create an instance of `IdTokenVerifier` and call the `verify` method to verify an ID token:

```js
import IdTokenVerifier from 'idtoken-verifier';

const verifier = new IdTokenVerifier({
  issuer: 'https://my.auth0.com/',
  audience: 'gYSNlU4YC4V1YPdqq8zPQcup6rJw1Mbt'
});

verifier.verify(id_token, nonce, (error, payload) => {
  if (error) {
    // handle the error
    return;
  }

  // do something with `payload`
});
```

## API Reference

- [IdTokenVerifier constructor](https://auth0.github.io/idtoken-verifier/IdTokenVerifier.html)
- [verify](https://auth0.github.io/idtoken-verifier/global.html#verify)
- [decode](https://auth0.github.io/idtoken-verifier/global.html#decode)
- [validateAccessToken](https://auth0.github.io/idtoken-verifier/global.html#validateAccessToken)

## Feedback

### Contributing

We appreciate feedback and contribution to this repo! Before you get started, please see the following:

- [Auth0's general contribution guidelines](https://github.com/auth0/open-source-template/blob/master/GENERAL-CONTRIBUTING.md)
- [Auth0's code of conduct guidelines](https://github.com/auth0/open-source-template/blob/master/CODE-OF-CONDUCT.md)
- [The contribution guide](https://github.com/auth0/open-source-template/blob/master/GENERAL-CONTRIBUTING.md)

### Raise an issue

To provide feedback or report a bug, please [raise an issue on our issue tracker](https://github.com/auth0/idtoken-verifier/issues).

### Vulnerability Reporting

Please do not report security vulnerabilities on the public GitHub issue tracker. The [Responsible Disclosure Program](https://auth0.com/whitehat) details the procedure for disclosing security issues.

## What is Auth0?

<p align="center">
  <picture>
    <source media="(prefers-color-scheme: dark)" srcset="https://cdn.auth0.com/website/sdks/logos/auth0_dark_mode.png" width="150">
    <source media="(prefers-color-scheme: light)" srcset="https://cdn.auth0.com/website/sdks/logos/auth0_light_mode.png" width="150">
    <img alt="Auth0 Logo" src="https://cdn.auth0.com/website/sdks/logos/auth0_light_mode.png" width="150">
  </picture>
</p>
<p align="center">
  Auth0 is an easy to implement, adaptable authentication and authorization platform. To learn more checkout <a href="https://auth0.com/why-auth0">Why Auth0?</a>
</p>
<p align="center">
  This project is licensed under the Apache 2.0 license. See the <a href="./LICENSE"> LICENSE</a> file for more info.
</p>


<!-- Vaaaaarrrrsss -->

[npm-image]: https://img.shields.io/npm/v/idtoken-verifier.svg?style=flat-square
[npm-url]: https://npmjs.org/package/idtoken-verifier
[circleci-image]: http://img.shields.io/circleci/project/github/auth0/idtoken-verifier.svg?branch=master&style=flat-square
[circleci-url]: https://circleci.com/gh/auth0/idtoken-verifier
[codecov-image]: https://img.shields.io/codecov/c/github/auth0/idtoken-verifier.svg?style=flat-square
[codecov-url]: https://codecov.io/github/auth0/idtoken-verifier?branch=master
[license-image]: http://img.shields.io/npm/l/idtoken-verifier.svg?style=flat-square
[license-url]: #license
[downloads-image]: http://img.shields.io/npm/dm/idtoken-verifier.svg?style=flat-square
[downloads-url]: https://npmjs.org/package/idtoken-verifier

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