Add basic tweet-bot stuff

This commit is contained in:
Luke Berndt
2021-03-03 22:22:53 -05:00
parent b872cfee45
commit a2205f3bac
6 changed files with 60 additions and 2 deletions

View File

@@ -0,0 +1,19 @@
var Strategy = require('passport-twitter').Strategy;
const User = require("../../models/user");
const twitter = new Strategy({
consumerKey: process.env['TWITTER_CONSUMER_KEY'],
consumerSecret: process.env['TWITTER_CONSUMER_SECRET'],
callbackURL: '/oauth/callback',
proxy: trustProxy
},
function(token, tokenSecret, profile, cb) {
// In this example, the user's Twitter profile is supplied as the user
// record. In a production-quality application, the Twitter profile should
// be associated with a user record in the application's database, which
// allows for account linking and authentication with other identity
// providers.
return cb(null, profile);
})
module.exports = local;

View File

@@ -1,6 +1,7 @@
/* Initializing PassportJS */
const User = require("../models/user");
const local = require("./passport-strategies/local");
const twitter = require("./passport-strategies/twitter");
module.exports = function (app, passport) {
// Configure Passport authenticated session persistence.