find-the-nest/index.js
DaInfLoop 843723c3d3
Initial commit
Contains previous works that were previously hosted on GitHub/my own git server. I deleted that commit history as there was nothing big and it's nice to start on a clean slate.
2024-08-15 22:21:44 +01:00

28 lines
785 B
JavaScript

const express = require('express');
require('dotenv').config()
const passport = require('passport');
const OAuth2Strategy = require('passport-oauth2');
const app = express();
passport.use('nest', new OAuth2Strategy({
authorizationURL: 'https://oauth.hackclub.app/oauth2/authorize',
tokenURL: 'https://oauth.hackclub.app/oauth2/token',
clientID: process.env.CLIENT_ID,
clientSecret: process.env.CLIENT_SECRET,
callbackURL: "https://findthenest.haroon.hackclub.app/"
},
function(accessToken, refreshToken, profile, cb) {
console.log(accessToken, refreshToken, profile)
cb(null, {})
}
));
app.use(passport.initialize())
app.get('/', passport.authenticate('nest'), (req, res) => {
res.json({ ok: true })
})
app.listen("/run/user/2151/ftn.sock")