
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
passport-snapchat
Advanced tools
Passport strategy for authenticating with Snapchat using the OAuth 2.0 API.
This module lets you authenticate using Snapchat in your Node.js applications. By plugging into Passport, Snapchat authorization can easily and unobtrusively be integrated into any application or framework that supports Connect-style middleware, including Express.
$ npm install passport-snapchat
Before using passport-snapchat
, you must register an application with
Snapchat. If you have not already done so, a new application can be created within the
Snap Kit Developer Portal. Your application will
be issued an app ID and app secret, which need to be provided to the strategy.
You will also need to configure a redirect URI which matches the route in your
application.
The Snapchat authorization strategy authenticates users using a Snapchat
account and OAuth 2.0 tokens. The app ID and secret obtained when creating an
application are supplied as options when creating the strategy. The strategy
also requires a verify
callback, which receives the access token and optional
refresh token, as well as profile
which contains the authenticated user's
Snapchat profile. The verify
callback must call cb
providing a user to
complete authorization.
passport.use(new SnapchatStrategy({
clientID: snapchat_APP_ID,
clientSecret: snapchat_APP_SECRET,
callbackURL: "http://localhost:3000/auth/snapchat/callback"
},
function(accessToken, refreshToken, profile, cb) {
User.findOrCreate({ snapchatId: profile.id }, function (err, user) {
return cb(err, user);
});
}
));
Use passport.authenticate()
, specifying the 'snapchat'
strategy, to
authenticate requests.
For example, as route middleware in an Express application:
app.get('/auth/snapchat',
passport.authenticate('snapchat'));
app.get('/auth/snapchat/callback',
passport.authenticate('snapchat', { failureRedirect: '/login' }),
function(req, res) {
// Successful authorization, redirect home.
res.redirect('/');
});
Developers using the popular Express web framework can refer to an example as a starting point for their own web applications.
If you need additional permissions from the user, the permissions can be
requested via the scope
option to passport.authenticate()
.
app.get('/auth/snapchat',
passport.authenticate('snapchat', { scope: ['user.display_name', 'user.bitmoji.avatar'] }));
Refer to permissions with Snapchat Login for further details.
The Snapchat profile contains information about a user. By default,
NO fields in a profile are returned. The fields needed by an application
can be indicated by setting the profileFields
option.
new SnapchatStrategy({
clientID: snapchat_APP_ID,
clientSecret: snapchat_APP_SECRET,
callbackURL: "http://localhost:3000/auth/snapchat/callback",
profileFields: ['id', 'displayName', 'bitmoji']
}), ...)
Refer to the Login Kit section of the docs for the complete set of available fields.
The test suite is located in the test/
directory. All new features are
expected to have corresponding test cases. Ensure that the complete test suite
passes by executing:
$ npm test
Copyright (c) 2018 Snap Inc.
FAQs
Snapchat (OAuth 2.0) authorization strategy for Passport.
The npm package passport-snapchat receives a total of 1,241 weekly downloads. As such, passport-snapchat popularity was classified as popular.
We found that passport-snapchat 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
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.