Skip to content

thody/hapi-google-oauth2-certs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status npm version

Introduction

Registers a Hapi server method to retrieve Google oAuth2 certificates for validation of ID tokens. Since certificates do not change frequently, 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
});

About

Hapi Plugin to manage Google's oAuth2 certificates.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published