moved oauth controller endpoints to auth

This commit is contained in:
Sheen Capadngan
2023-05-24 23:44:30 +08:00
parent 93cf7cde2d
commit fac4968193
11 changed files with 25 additions and 37 deletions
+17
View File
@@ -1,6 +1,7 @@
import express from 'express';
const router = express.Router();
import { body } from 'express-validator';
import passport from 'passport';
import { requireAuth, validateRequest } from '../../middleware';
import { authController } from '../../controllers/v1';
import { authLimiter } from '../../helpers/rateLimiter';
@@ -44,4 +45,20 @@ router.post(
);
router.get(
'/redirect/google',
authLimiter,
passport.authenticate('google', {
scope: ['profile', 'email'],
session: false,
}),
)
router.get(
'/callback/google',
passport.authenticate('google', { failureRedirect: '/login/provider/error', session: false }),
authController.handleAuthProviderCallback,
)
export default router;
-2
View File
@@ -16,7 +16,6 @@ import stripe from './stripe';
import integration from './integration';
import integrationAuth from './integrationAuth';
import secretsFolder from './secretsFolder';
import oauth from './oauth';
export {
signup,
@@ -30,7 +29,6 @@ export {
membership,
key,
inviteOrg,
oauth,
secret,
serviceToken,
password,
-22
View File
@@ -1,22 +0,0 @@
import express from 'express';
const router = express.Router();
import passport from 'passport';
import { oauthController } from '../../controllers/v1';
import { authLimiter } from '../../helpers/rateLimiter';
router.get(
'/redirect/google',
authLimiter,
passport.authenticate('google', {
scope: ['profile', 'email'],
session: false,
}),
)
router.get(
'/callback/google',
passport.authenticate('google', { failureRedirect: '/login/provider/error', session: false }),
oauthController.handleAuthProviderCallback,
)
export default router;