# google-id-token-verifier

> A small library to validate a google ID token for consuming it in node.js backend server.

Latest version **0.2.3** (published 2016-07-12) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install google-id-token-verifier
pnpm add google-id-token-verifier
yarn add google-id-token-verifier
bun add google-id-token-verifier
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.3 |
| Published | 2016-07-12 |
| First published | 2015-11-18 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 23 |
| Author | Catstail |
| Maintainers | maeltm |
| Keywords | googleapi, id-token |

## Links

- npm: https://www.npmjs.com/package/google-id-token-verifier
- Repository: https://github.com/maeltm/node-google-id-token-verifier
- Homepage: https://github.com/maeltm/node-google-id-token-verifier#readme
- Issues: https://github.com/maeltm/node-google-id-token-verifier/issues
- npm.io page: https://npm.io/package/google-id-token-verifier

## Dependencies (3)

- [request](https://npm.io/package/request.md) ^2.65.0
- [underscore](https://npm.io/package/underscore.md) ^1.8.3
- [rsa-pem-from-mod-exp](https://npm.io/package/rsa-pem-from-mod-exp.md) ^0.8.4

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.2.3 (latest) — 2016-07-12
- 0.2.2 — 2016-07-07
- 0.2.1 — 2016-07-06
- 0.2.0 — 2016-06-28
- 0.1.2 — 2015-11-18
- 0.1.1 — 2015-11-18
- 0.1.0 — 2015-11-18

## README

# google-id-token-verifier
[![Build Status][travisimg]][travis]
[![Coverage Status][coverallsimg]][coveralls]

This is library to validate a google ID token for consuming it in [node.js][node] backend server.
This is very similar to google's [tokeninfo endpoint][tokeninfo].

## Installation

```bash
npm install google-id-token-verifier --save
```

## Usage

```js
var verifier = require('google-id-token-verifier');

// ID token from client.
var IdToken = 'XYZ123';

// app's client IDs to check with audience in ID Token.
var clientId = 'abc123.apps.googleusercontent.com';

verifier.verify(IdToken, clientId, function (err, tokenInfo) {
  if (!err) {
    // use tokenInfo in here.
    console.log(tokenInfo);
  }
});
```

## Tests

```bash
npm test
```
or
```bash
npm prepare
```

## Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style.
Add unit tests for any new or changed functionality. Lint and test your code.

## Third-party libraries

The following third-party libraries are used by this module:

* request: https://github.com/request/request - to get google's oauth2 federated signon certs.
* underscore: http://underscorejs.org

## Inspired by

* google-auth-library-nodejs - https://github.com/google/google-auth-library-nodejs
* google-id-token - https://github.com/gmelika/google-id-token

## Release History

* 0.2.0 Make CertCache get certs url from discovery document (Thx cakenggt).
* 0.1.0 Initial release

[travisimg]: https://travis-ci.org/maeltm/node-google-id-token-verifier.svg?branch=master
[travis]: https://travis-ci.org/maeltm/node-google-id-token-verifier
[coverallsimg]: https://coveralls.io/repos/maeltm/node-google-id-token-verifier/badge.svg?branch=master&service=github
[coveralls]: https://coveralls.io/github/maeltm/node-google-id-token-verifier?branch=master
[node]: http://nodejs.org/
[tokeninfo]: https://www.googleapis.com/oauth2/v3/tokeninfo

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