
Security News
Static vs. Runtime Reachability: Insights from Latio’s On the Record Podcast
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.
passport-gigya-oauth2
Advanced tools
Gigya OAuth 2.0 authentication strategy for Passport.
This module lets you authenticate using Gigya in your Node.js applications. By plugging into Passport, Gigya authentication can be easily and unobtrusively integrated into any application or framework that supports Connect-style middleware, including Express.
$ npm install passport-gigya-oauth2
The Gigya authentication strategy authenticates users using a Gigya
account and OAuth 2.0 tokens. Gigya's OAuth 2.0 endpoints, as well as
the client identifer and secret, are specified as options. The strategy
requires a verify
callback, which receives an access token and profile,
and calls done
providing a user.
passport.use(new OAuth2Strategy({
authorizationURL: 'https://<Data_Center>/oidc/op/v1.0/<API_KEY>/authorize',
tokenURL: 'https://<Data_Center>/oidc/op/v1.0/<API_KEY>/token',
userInfoURL: 'https://<Data_Center>/oidc/op/v1.0/<API_KEY>/userinfo',
clientID: EXAMPLE_CLIENT_ID,
clientSecret: EXAMPLE_CLIENT_SECRET,
callbackURL: "http://localhost:3000/auth/oauth2/callback',
customHeaders: {'Authorization': 'Basic MTIzLTQ1Ni03ODk6c2hoaC1pdHMtYS1zZWNyZXQ='}
},
function(accessToken, refreshToken, profile, done) {
User.findOne({ 'gigya.sub': profile.sub }, function (err, user) {
if (err) { return done(err); }
if (user) {
return done(null, user);
} else {
var newUser = new User();
newUser.gigya.sub = profile.sub;
newUser.gigya.token = accessToken;
newUser.gigya.name = profile.name;
newUser.gigya.email = profile.email;
newUser.save(function(err) {
if (err) { throw err; }
return done(null, newUser);
});
}
});
}
));
Use passport.authenticate()
, specifying the 'oauth2'
strategy, to
authenticate requests.
For example, as route middleware in an Express application:
app.get('/auth/oauth2',
passport.authenticate('oauth2', { scope : ['openid', 'profile', 'email'] }));
app.get('/auth/oauth2/callback',
passport.authenticate('oauth2', { failureRedirect: '/login' }),
function(req, res) {
// Successful authentication, redirect home.
res.redirect('/');
});
$ npm install
$ npm test
FAQs
Gigya OAuth 2.0 authentication strategy for Passport.
The npm package passport-gigya-oauth2 receives a total of 1,554 weekly downloads. As such, passport-gigya-oauth2 popularity was classified as popular.
We found that passport-gigya-oauth2 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
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.
Security News
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.