Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
moved oauth controller endpoints to auth
Sheen Capadnganfac496819399
diff --git a/backend/src/controllers/v1/authController.ts b/backend/src/controllers/v1/authController.tsindex e60002e9d4..c1725456cf 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.tsindex 8a8b1d54d8..1da61835fc 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.tsdeleted file mode 100644index 5f1511e39e..0000000000--- 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.tsindex c3b2ec726b..36e2022e02 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.tsindex 2125aaf807..20f5ec9b86 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.tsindex a38a5bfb2e..62ff08b148 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.tsdeleted file mode 100644index d817e64673..0000000000--- 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.tsindex bde062b56a..5144af16d6 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.mdxindex 0360b6e3ca..dc3de4089f 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 GooFollow 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 Configurationdiff --git a/frontend/src/components/login/InitialLoginStep.tsx b/frontend/src/components/login/InitialLoginStep.tsxindex 2fb3a8a4d7..973392f643 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={<FontAwesomeIcon icon={faGoogle} className="mr-1" />}className="h-14 w-full mx-0"diff --git a/frontend/src/components/signup/InitialSignupStep.tsx b/frontend/src/components/signup/InitialSignupStep.tsxindex fd83543a08..2c804ef713 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={<FontAwesomeIcon icon={faGoogle} className="mr-1" />}className="h-14 w-full mx-0"