Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
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 passport-token-google2
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-google2').Strategy
passport.use(new GoogleStrategy({
clientID: GOOGLE_CLIENT_ID,
clientSecret: GOOGLE_CLIENT_SECRET
},
function(accessToken, refreshToken, profile, done) {
fetchGoogleUser(profile, accessToken)
.then((user) => done(null, user))
.catch((err) => {
// Handle the error
done(null, {})
});
}
));
Use passport.authenticate('google-token')
to authenticate requests.
router.get('/auth/google/token', passport.authenticate('google-token'), someFunction);
GET request need to have id_token
sent as access_token
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.
Complaint with UserIdentity and User model of loopback
The module can be used to authenticate id_token
sent by client side(android,ios or web) on the loopback as access_token
in the callbackPath as GET argument.
Add this to providers.json as described in tutorial!.
"google-login": {
"provider": "google",
"module": "passport-token-google2",
"clientID": "{google-client-id-1}",
"clientSecret": "{google-client-secret-1}",
"callbackPath": "/auth/google/token",
"scope": ["email", "profile"],
"failureFlash": true,
"json": true,
"session": false
}
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.