hapi-google-oauth2-certs
v0.0.1
Published
Hapi Plugin to manage Google's oAuth2 certificates.
Downloads
8
Readme
Introduction
Registers a Hapi server method to retrieve Google oAuth2 certificates for validation of ID tokens. Since certificates do not change regularly, they are cached using Hapi's native cache for 24 hours to eliminate unnecessary network calls.
Usage
Register this plugin:
server.register({ register: require('hapi-google-oauth2-certs') }, function (err) {
if (err) {
console.error('Failed to load plugin:', err);
}
});
Retrieve a certificate:
server.methods.auth.google.getCertificate('someCertificateId', function (err, certificate) {
if (err) {
// Handle error
}
// Use certificate
});