node.js library for integrating with Google sign in

Installation

npm install google-sign-in

Example Usage

var GoogleSignIn = require ( ' google-sign-in ' ) ; var project = new GoogleSignIn . Project ( ' your-client-id.apps.googleusercontent.com ' , ' your-other-client-id.apps.googleusercontent.com ' ) ; project . verifyToken ( ' token ' ) . then ( ( jsonData ) => { console . log ( JSON . stringify ( jsonData ) ) ; } , ( error ) => { console . error ( error . message ) ; } ) ;

Documentation

Project - Class

constructor(clientIds) - constructor - Creates a new Project with the specified clientIds clientIds - required string... - Valid client IDs from the Google Developers project seperated by commas or an array

- constructor - Creates a new with the specified verifyToken(idToken) - function - Verifies an ID token idToken - required string - The ID token to verify returns a promise Rejects with an error object if an error occurs Resolves with a JSON object if everything goes well Documentation on this object can be found here.

- function - Verifies an ID token clientIds - string[] - List of client IDs

Purpose

Making authenticating with Google sign-in easier.

Contributions

To submit issues, use the GitHub issue tracker. To submit code, use a pull request, found here. To issue a private vulnerability report, email a contributor.

CII Best Practices, bitHound standards, Synk, and Jacks standards should be met.

License (MIT)

Copyright 2017 Bennett Somerville

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.