Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
passport-automatic
Advanced tools
Passport strategy for authenticating with Automatic using the OAuth 2.0 API.
This module lets you authenticate using Automatic in your Node.js applications. By plugging into Passport, Automatic authentication can be easily and unobtrusively integrated into any application or framework that supports Connect-style middleware, including Express.
$ npm install passport-automatic
The Automatic authentication strategy authenticates users using a GitHub 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 client ID, client secret, and callback URL.
passport.use(new AutomaticStrategy({
clientID: AUTOMATIC_CLIENT_ID,
clientSecret: AUTOMATIC_CLIENT_SECRET,
scope: ['scope:user:profile', 'scope:trip', 'scope:location', 'scope:vehicle:profile', 'scope:vehicle:events', 'scope:behavior']
},
function(accessToken, refreshToken, profile, done) {
User.findOrCreate({ automaticId: profile.id }, function (err, user) {
return done(err, user);
});
}
));
Use passport.authenticate()
, specifying the 'automatic'
strategy, to
authenticate requests.
For example, as route middleware in an Express application:
app.get('/auth/automatic',
passport.authenticate('automatic'));
app.get('/auth/automatic/callback',
passport.authenticate('automatic', { failureRedirect: '/login' }),
function(req, res) {
// Successful authentication, redirect home.
res.redirect('/');
});
Passport adds a user
attribute to req
, so you can get the access token with req.user.accessToken
.
Example:
//fetches most recent 25 trips
request.get({
uri: 'https://api.automatic.com/trip/',
headers: {Authorization: 'bearer ' + req.user.accessToken},
json: true
}, function(e, r, body) {
//body contains api response
});
This project is licensed under the terms of the Apache 2.0 license.
FAQs
Automatic.com authentication strategy for Passport
We found that passport-automatic demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.