google-token-auth
Node.js middleware to validate Google ID Tokens
in the backend server
.
Validade the request token, get all the Google ID Token fields and populate the req.googleProfileInfo
.
Installation
$ npm install google-idtoken-auth
Options
Propertie | Type | Default | Required | Description |
---|---|---|---|---|
clientId | String | true | Specify the Google Client ID | |
tokenHeaderName | String | x-googleid-token | false | Custom header name to retrievi the Google ID Token |
gSuiteDomains | Array | false | Specify a G Suite domain |
Example
var express = ;var googleAuth = ; var googleTokenVerifier = googleAuth; var app = ;app; app; app; // curl command that sends an HTTP request with a valid Google ID Token// curl -H "x-googleid-token: {GOOGLE-ID-TOKEN-HERE}" http://127.0.0.1:8080
See more
Google Sign-In Authenticate with a backend server