diff --git a/backend/src/controllers/v1/authController.ts b/backend/src/controllers/v1/authController.ts
index e60002e9d..c1725456c 100644
--- a/backend/src/controllers/v1/authController.ts
+++ b/backend/src/controllers/v1/authController.ts
@@ -267,3 +267,7 @@ export const getNewToken = async (req: Request, res: Response) => {
});
}
};
+
+export const handleAuthProviderCallback = (req: Request, res: Response) => {
+ res.redirect(`/login/provider/success?token=${encodeURIComponent(req.providerAuthToken)}`);
+}
diff --git a/backend/src/controllers/v1/index.ts b/backend/src/controllers/v1/index.ts
index 8a8b1d54d..1da61835f 100644
--- a/backend/src/controllers/v1/index.ts
+++ b/backend/src/controllers/v1/index.ts
@@ -5,7 +5,6 @@ import * as integrationController from './integrationController';
import * as keyController from './keyController';
import * as membershipController from './membershipController';
import * as membershipOrgController from './membershipOrgController';
-import * as oauthController from './oauthController';
import * as organizationController from './organizationController';
import * as passwordController from './passwordController';
import * as secretController from './secretController';
@@ -24,7 +23,6 @@ export {
keyController,
membershipController,
membershipOrgController,
- oauthController,
organizationController,
passwordController,
secretController,
diff --git a/backend/src/controllers/v1/oauthController.ts b/backend/src/controllers/v1/oauthController.ts
deleted file mode 100644
index 5f1511e39..000000000
--- a/backend/src/controllers/v1/oauthController.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-import { Request, Response } from 'express';
-
-export const handleAuthProviderCallback = (req: Request, res: Response) => {
- res.redirect(`/login/provider/success?token=${encodeURIComponent(req.providerAuthToken)}`);
-}
diff --git a/backend/src/index.ts b/backend/src/index.ts
index c3b2ec726..36e2022e0 100644
--- a/backend/src/index.ts
+++ b/backend/src/index.ts
@@ -39,7 +39,6 @@ import {
membership as v1MembershipRouter,
key as v1KeyRouter,
inviteOrg as v1InviteOrgRouter,
- oauth as v1OAuth,
user as v1UserRouter,
userAction as v1UserActionRouter,
secret as v1SecretRouter,
@@ -135,7 +134,6 @@ const main = async () => {
// v1 routes (default)
app.use("/api/v1/signup", v1SignupRouter);
app.use("/api/v1/auth", v1AuthRouter);
- app.use("/api/v1/oauth", v1OAuth);
app.use("/api/v1/bot", v1BotRouter);
app.use("/api/v1/user", v1UserRouter);
app.use("/api/v1/user-action", v1UserActionRouter);
diff --git a/backend/src/routes/v1/auth.ts b/backend/src/routes/v1/auth.ts
index 2125aaf80..20f5ec9b8 100644
--- a/backend/src/routes/v1/auth.ts
+++ b/backend/src/routes/v1/auth.ts
@@ -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;
diff --git a/backend/src/routes/v1/index.ts b/backend/src/routes/v1/index.ts
index a38a5bfb2..62ff08b14 100644
--- a/backend/src/routes/v1/index.ts
+++ b/backend/src/routes/v1/index.ts
@@ -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,
diff --git a/backend/src/routes/v1/oauth.ts b/backend/src/routes/v1/oauth.ts
deleted file mode 100644
index d817e6467..000000000
--- a/backend/src/routes/v1/oauth.ts
+++ /dev/null
@@ -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;
diff --git a/backend/src/utils/auth.ts b/backend/src/utils/auth.ts
index bde062b56..5144af16d 100644
--- a/backend/src/utils/auth.ts
+++ b/backend/src/utils/auth.ts
@@ -68,7 +68,7 @@ const initializePassport = async () => {
passReqToCallback: true,
clientID: googleClientId,
clientSecret: googleClientSecret,
- callbackURL: '/api/v1/oauth/callback/google',
+ callbackURL: '/api/v1/auth/callback/google',
scope: ['profile', ' email'],
}, async (
req: express.Request,
diff --git a/docs/self-hosting/authentication/google.mdx b/docs/self-hosting/authentication/google.mdx
index 0360b6e3c..dc3de4089 100644
--- a/docs/self-hosting/authentication/google.mdx
+++ b/docs/self-hosting/authentication/google.mdx
@@ -6,7 +6,7 @@ To enable Google Auth for your Infisical project, you first need to set up a Goo
Follow Google's Setting up OAuth 2.0 documentation [here](https://support.google.com/googleapi/answer/6158849). After the setup, copy the Client ID and Client secret. You will need them below.
## Configure Redirect URI
-Add the following URI to the Authorized redirect URIs section in the OAuth Client credentials page - `BASE_URL/api/v1/oauth/callback/google`. Replace BASE_URL with the URL of your hosted Infisical instance.
+Add the following URI to the Authorized redirect URIs section in the OAuth Client credentials page - `BASE_URL/api/v1/auth/callback/google`. Replace BASE_URL with the URL of your hosted Infisical instance.

## General Configuration
diff --git a/frontend/src/components/login/InitialLoginStep.tsx b/frontend/src/components/login/InitialLoginStep.tsx
index 2fb3a8a4d..973392f64 100644
--- a/frontend/src/components/login/InitialLoginStep.tsx
+++ b/frontend/src/components/login/InitialLoginStep.tsx
@@ -20,7 +20,7 @@ export default function InitialLoginStep({
colorSchema="primary"
variant="solid"
onClick={() => {
- window.open('/api/v1/oauth/redirect/google')
+ window.open('/api/v1/auth/redirect/google')
}}
leftIcon={}
className="h-14 w-full mx-0"
diff --git a/frontend/src/components/signup/InitialSignupStep.tsx b/frontend/src/components/signup/InitialSignupStep.tsx
index fd83543a0..2c804ef71 100644
--- a/frontend/src/components/signup/InitialSignupStep.tsx
+++ b/frontend/src/components/signup/InitialSignupStep.tsx
@@ -19,7 +19,7 @@ export default function InitialSignupStep({
colorSchema="primary"
variant="solid"
onClick={() => {
- window.open('/api/v1/oauth/redirect/google')
+ window.open('/api/v1/auth/redirect/google')
}}
leftIcon={}
className="h-14 w-full mx-0"