From 795e834e47050ed10dd152d8b81cc348988c4b55 Mon Sep 17 00:00:00 2001 From: victorAnumudu Date: Thu, 25 May 2023 20:00:13 +0100 Subject: [PATCH 1/3] added google login interface --- .env | 2 ++ .env.development | 2 ++ .env.production | 2 ++ src/components/AuthPages/Login/index.jsx | 46 +++++++++++++++--------- src/index.js | 6 +++- 5 files changed, 40 insertions(+), 18 deletions(-) diff --git a/.env b/.env index 0b4c923..112ed44 100644 --- a/.env +++ b/.env @@ -34,5 +34,7 @@ REACT_APP_ITEM_PER_PAGE=5 # Empty Listings REACT_APP_ZERO_STATE=0 +REACT_APP_GOOGLE_CLIENT_ID=234407841224-k5g7f67p908hqtegiokmjqt8qqf3hi2i.apps.googleusercontent.com + #apigate.lotus.g1.wrenchboard.com:76.209.103.227 #apigate.orion.g1.wrenchboard.com:76.209.103.227 diff --git a/.env.development b/.env.development index 3efdd7a..238d521 100644 --- a/.env.development +++ b/.env.development @@ -33,3 +33,5 @@ REACT_APP_ITEM_PER_PAGE=5 #apigate.lotus.g1.wrenchboard.com:76.209.103.227 #apigate.orion.g1.wrenchboard.com:76.209.103.227 + +REACT_APP_GOOGLE_CLIENT_ID=234407841224-k5g7f67p908hqtegiokmjqt8qqf3hi2i.apps.googleusercontent.com \ No newline at end of file diff --git a/.env.production b/.env.production index 6d4177b..193f01c 100644 --- a/.env.production +++ b/.env.production @@ -33,3 +33,5 @@ REACT_APP_ITEM_PER_PAGE=5 #apigate.orion.g1.wrenchboard.com:76.209.103.227 #apigate.orion.g1.wrenchboard.com:76.209.103.227 + +REACT_APP_GOOGLE_CLIENT_ID=234407841224-k5g7f67p908hqtegiokmjqt8qqf3hi2i.apps.googleusercontent.com \ No newline at end of file diff --git a/src/components/AuthPages/Login/index.jsx b/src/components/AuthPages/Login/index.jsx index a22dd60..a17aba1 100644 --- a/src/components/AuthPages/Login/index.jsx +++ b/src/components/AuthPages/Login/index.jsx @@ -8,8 +8,8 @@ import WrenchBoard from "../../../assets/images/wrenchboard.png"; import usersService from "../../../services/UsersService"; import InputCom from "../../Helpers/Inputs/InputCom"; import AuthLayout from "../AuthLayout"; -//import { GoogleOAuthProvider } from '@react-oauth/google'; -// import { googleLogout, useGoogleLogin } from '@react-oauth/google'; +// import { GoogleOAuthProvider } from '@react-oauth/google'; +import { googleLogout, useGoogleLogin } from '@react-oauth/google'; import { useDispatch } from "react-redux"; import { updateUserDetails } from "../../../store/UserDetails"; @@ -120,6 +120,18 @@ export default function Login() { }); }; + const googleLogin = useGoogleLogin({ + onSuccess: async (tokenResponse) => { + console.log(tokenResponse); + // const userInfo = await axios.get( + // 'https://www.googleapis.com/oauth2/v3/userinfo', + // { headers: { Authorization: `Bearer ${tokenResponse.access_token}` } }, + // ); + // console.log(userInfo); + }, + onError: errorResponse => console.log(errorResponse), + }); + useEffect(()=>{ setMail('') setPassword('') @@ -246,7 +258,7 @@ export default function Login() {
- +
@@ -347,10 +359,10 @@ export default function Login() { ); } -const BrandBtn = ({ link, imgSrc, brand }) => { - const doGoogle = async () => { - alert("start google"); - }; +const BrandBtn = ({ link, imgSrc, brand, onClick }) => { + // const doGoogle = async () => { + // alert("start google"); + // }; // onSuccess: (codeResponse) => setUser(codeResponse), @@ -359,26 +371,26 @@ const BrandBtn = ({ link, imgSrc, brand }) => { // onError: (error) => console.log('Login Failed:', error) // }); - const doApple = async () => { - alert("start apple"); - }; + // const doApple = async () => { + // alert("start apple"); + // }; - const doFacebook = async () => { - alert("start facebook"); - }; + // const doFacebook = async () => { + // alert("start facebook"); + // }; return (
- logo-icon(s) Continue with {brand} - +
); }; diff --git a/src/index.js b/src/index.js index 33518b5..1585065 100644 --- a/src/index.js +++ b/src/index.js @@ -6,11 +6,15 @@ import App from "./App"; import "./index.css"; import store from "./store/store"; +import { GoogleOAuthProvider } from '@react-oauth/google'; + const root = document.getElementById("root"); ReactDOM.createRoot(root).render( - + + + ); -- 2.34.1 From 499753bc54a328eda8fdea15f2900c9001245a5b Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Thu, 25 May 2023 16:20:42 -0400 Subject: [PATCH 2/3] ADD GOOGLE IDS --- .env | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.env b/.env index 112ed44..e329a4a 100644 --- a/.env +++ b/.env @@ -34,7 +34,10 @@ REACT_APP_ITEM_PER_PAGE=5 # Empty Listings REACT_APP_ZERO_STATE=0 -REACT_APP_GOOGLE_CLIENT_ID=234407841224-k5g7f67p908hqtegiokmjqt8qqf3hi2i.apps.googleusercontent.com +#REACT_APP_GOOGLE_CLIENT_ID_RET=234407841224-k5g7f67p908hqtegiokmjqt8qqf3hi2i.apps.googleusercontent.com + +REACT_APP_GOOGLE_CLIENT_ID=817021856543-ad9nsjgdpsu2s2jrl63j3ihrv7lbf6ma.apps.googleusercontent.com +REACT_APP_GOOGLE_CLIENT_SECRET=aozK_2G8UjaCmLgPPkv9abIm #apigate.lotus.g1.wrenchboard.com:76.209.103.227 #apigate.orion.g1.wrenchboard.com:76.209.103.227 -- 2.34.1 From f44ade7818cf616f9c63b1613818c0de67fdd5b8 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Thu, 25 May 2023 16:33:46 -0400 Subject: [PATCH 3/3] fscebook setings --- .env | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.env b/.env index e329a4a..30ef0c4 100644 --- a/.env +++ b/.env @@ -38,6 +38,13 @@ REACT_APP_ZERO_STATE=0 REACT_APP_GOOGLE_CLIENT_ID=817021856543-ad9nsjgdpsu2s2jrl63j3ihrv7lbf6ma.apps.googleusercontent.com REACT_APP_GOOGLE_CLIENT_SECRET=aozK_2G8UjaCmLgPPkv9abIm +REACT_APP_GOOGLE_CLIENT_SCOPE="https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile" + + +REACT_APP_FACEBOOK_CLIENT_ID=390204307987009 +REACT_APP_FACEBOOK_CLIENT_SECRET=19f778e312f2ab96d147bacb612910c2 +REACT_APP_FACEBOOK_CLIENT_SCOPE="email, public_profile" + #apigate.lotus.g1.wrenchboard.com:76.209.103.227 #apigate.orion.g1.wrenchboard.com:76.209.103.227 -- 2.34.1