diff --git a/frontend/src/components/authentication/LoginPage.jsx b/frontend/src/components/authentication/LoginPage.jsx
index 12ad18e..a48c075 100644
--- a/frontend/src/components/authentication/LoginPage.jsx
+++ b/frontend/src/components/authentication/LoginPage.jsx
@@ -7,6 +7,8 @@ import { loadFull } from "tsparticles";
import refreshAccessToken from "./refreshAcesstoken";
import axiosapi from "../../api/AuthenticationApi";
import { useAuth } from "../../hooks/authentication/IsAuthenticated";
+import { FcGoogle } from "react-icons/fc";
+
function LoginPage() {
const Navigate = useNavigate();
@@ -208,7 +210,7 @@ function LoginPage() {
className="btn btn-outline btn-secondary w-full "
onClick={() => googleLoginImplicit()}
>
- Login with Google
+ Login with Google
{/* Forgot Password Link */}
diff --git a/frontend/src/components/authentication/SignUpPage.jsx b/frontend/src/components/authentication/SignUpPage.jsx
index 0370d55..50d893b 100644
--- a/frontend/src/components/authentication/SignUpPage.jsx
+++ b/frontend/src/components/authentication/SignUpPage.jsx
@@ -4,6 +4,9 @@ import axiosapi from "../../api/AuthenticationApi";
import { useCallback } from "react";
import Particles from "react-tsparticles";
import { loadFull } from "tsparticles";
+import { FcGoogle } from "react-icons/fc";
+import { useGoogleLogin } from "@react-oauth/google";
+
function Copyright(props) {
return (
@@ -64,6 +67,28 @@ export default function SignUp() {
console.log(container);
}, []);
+ const googleLoginImplicit = useGoogleLogin({
+ flow: "auth-code",
+ redirect_uri: "postmessage",
+ onSuccess: async (response) => {
+ try {
+ const loginResponse = await axiosapi.googleLogin(response.code);
+ if (loginResponse && loginResponse.data) {
+ const { access_token, refresh_token } = loginResponse.data;
+
+ localStorage.setItem("access_token", access_token);
+ localStorage.setItem("refresh_token", refresh_token);
+ setIsAuthenticated(true);
+ Navigate("/");
+ }
+ } catch (error) {
+ console.error("Error with the POST request:", error);
+ setIsAuthenticated(false);
+ }
+ },
+ onError: (errorResponse) => console.log(errorResponse),
+ });
+
return (