
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@acceleratxr/passport-twitter
Advanced tools
Passport strategy for authenticating with Twitter using the OAuth 2.0 API.
Passport strategy for authenticating with Discord access tokens using the OAuth 2.0 API.
This module lets you authenticate using Discord in your Node.js applications using the Passport framework.
npm install passport-discord-token
or
yarn add passport-discord-token
The Discord authentication strategy authenticates users using a Discord account and OAuth 2.0 tokens. The strategy
requires a verify
callback to perform a look up of the user account given a verified OAuth 2.0 token.
const DiscordTokenStrategy = require('passport-discord-token');
passport.use(new DiscordTokenStrategy({
clientID: DISCORD_APP_ID,
clientSecret: DISCORD_APP_SECRET,
apiVersion: "v8"
}, function(accessToken, refreshToken, profile, done) {
User.findOrCreate({discordId: profile.id}, function (error, user) {
return done(error, user);
});
}
));
import { DiscordTokenStrategy } from "passport-discord-token";
passport.use(new DiscordTokenStrategy({
clientID: DISCORD_APP_ID,
clientSecret: DISCORD_APP_SECRET,
apiVersion: "v8"
}, function(accessToken, refreshToken, profile, done) {
User.findOrCreate({discordId: profile.id}, function (error, user) {
return done(error, user);
});
}
));
Use passport.authenticate()
, specifying discord-token
as the strategy to authenticate requests.
app.post('/auth/discord/token',
passport.authenticate('discord-token'),
function (req, res) {
// do something with req.user
res.send(req.user? 200 : 401);
}
);
Clients can send requests to routes that use the passport-discord-token strategy using query params. Clients must
transmit the code
parameter that is received after Discord login. Clients may also optionally transmit a state
parameter.
GET /auth/discord/token?code=<TOKEN_HERE>&state=<STATE_HERE>
FAQs
Passport strategy for authenticating with Twitter using the OAuth 2.0 API.
The npm package @acceleratxr/passport-twitter receives a total of 1 weekly downloads. As such, @acceleratxr/passport-twitter popularity was classified as not popular.
We found that @acceleratxr/passport-twitter 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.