change to use session for auth

+ replace BearerAuth to cookieAuth in swagger
+ add swagger.yaml to nodemon watch list
This commit is contained in:
wancat committed 2023-09-17 11:27:37 +08:00
1 parent a6d02f2616
commit be5cd152a9
13 files changed
+216 -71

No files matched your search

+7 -10
View File
@@ -6,6 +6,7 @@ import commands from './commands.js'
import authRouter from './auth.js'
const router = Router()
router.use(passport.authenticate('session'))
router.get('/', (req, res) => {
res.send('Hello API!')
@@ -13,15 +14,11 @@ router.get('/', (req, res) => {
router.use('/auth', authRouter)
router.use('/quests', quests)
router.use(
'/sessions',
passport.authenticate('jwt', { session: false, failWithError: true }),
sessions
)
router.use(
'/commands',
passport.authenticate('jwt', { session: false, failWithError: true }),
commands
)
const authZone = Router()
authZone.use('/sessions', sessions)
authZone.use('/commands', commands)
router.use(authZone)
export default router