From bb052e8dbc64465ff6eca038014788f18b9b2b09 Mon Sep 17 00:00:00 2001 From: Cristi Miloiu Date: Sat, 4 Jan 2025 15:40:55 +0200 Subject: [PATCH 1/3] Add Google Auth0 to authenticate users --- client/src/configs/env_handler.tsx | 2 + client/src/main.tsx | 16 ++-- client/src/network/api_axios.tsx | 29 +++++- client/src/views/login.view.tsx | 117 +++++++++++++++++++++-- server/config/env_handler.py | 2 + server/controllers/auth_controller.py | 46 ++++++++- server/controllers/session_controller.py | 9 +- server/dtos/user.py | 3 + server/models/user.py | 3 +- server/requirements.txt | 2 + server/routes/auth.py | 17 +++- 11 files changed, 222 insertions(+), 24 deletions(-) diff --git a/client/src/configs/env_handler.tsx b/client/src/configs/env_handler.tsx index 1aa05e4..177c1cf 100644 --- a/client/src/configs/env_handler.tsx +++ b/client/src/configs/env_handler.tsx @@ -1 +1,3 @@ export const API_URL = import.meta.env.VITE_API_URL; + +export const GOOGLE_CLIENT_ID = import.meta.env.VITE_GOOGLE_CLIENT_ID; \ No newline at end of file diff --git a/client/src/main.tsx b/client/src/main.tsx index 75d496a..e95c6a7 100644 --- a/client/src/main.tsx +++ b/client/src/main.tsx @@ -7,6 +7,8 @@ import Preloader from "./components/Preloader.component"; import { PreloaderProvider } from "./contexts/preloader_provider"; import { ThemeProvider } from "./contexts/theme_provider"; import { Footer } from "./components/footer.component"; +import { GoogleOAuthProvider } from "@react-oauth/google"; +import { GOOGLE_CLIENT_ID } from "./configs/env_handler"; const App = () => { return ( @@ -28,14 +30,16 @@ const App = () => { }; ReactDOM.createRoot(document.getElementById("root")!).render( - - - - + + + + +