Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
passport-token-google
Advanced tools
Passport strategy for authenticating with Google access tokens using the OAuth 2.0 API.
This module lets you authenticate using Google in your Node.js applications. By plugging into Passport, Google authentication can be easily and unobtrusively integrated into any application or framework that supports Connect-style middleware, including Express and Koa.
$ npm install --save passport-token-google
The Google authentication strategy authenticates users using a Google
account and OAuth 2.0 tokens. The strategy requires a verify
callback, which
accepts these credentials and calls done
providing a user, as well as
options
specifying a app ID and app secret.
const GoogleStrategy = require('passport-token-google').Strategy
passport.serializeUser((user, done) => {
done(null, user);
});
passport.deserializeUser((user, done) => {
done(null, user);
});
passport.use(new GoogleStrategy({
clientID: GOOGLE_CLIENT_ID,
clientSecret: GOOGLE_CLIENT_SECRET
},
function(idToken, refreshToken, profile, done) {
fetchGoogleUser(profile, idToken)
.then((user) => done(null, user))
.catch((err) => {
// Handle the error
done(null, {})
});
}
));
Use passport.authenticate('google-token')
to authenticate requests.
router.post('/auth/google/token', passport.authenticate('google-token'), someFunction);
GET request need to have id_token
sent in either the query string or set as a header.
If a POST is being preformed they can also be included in the body of the request like:
const body = { id_token: data.tokenId }
FAQs
Google token authentication strategy for Passport.
We found that passport-token-google demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.