google-id-token-verifier

0.2.3 • Public • Published

google-id-token-verifier

Build Status Coverage Status

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

Installation

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

Usage

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

npm test

or

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:

Inspired by

Release History

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

Readme

Keywords

Package Sidebar

Install

npm i google-id-token-verifier

Weekly Downloads

486

Version

0.2.3

License

Apache-2.0

Last publish

Collaborators

  • maeltm