Open Abhinav1182 opened 1 year ago
Facing the same issue. Any solutions?
I am also facing the same issue guys. Did you get any alternate solution? Please help me out
Facing the same issue on production, working fine for windows but MacBook.
https://www.npmjs.com/package/@react-oauth/google?activeTab=readme guys try this library working fine. I just fixed my issue with this library.
https://www.npmjs.com/package/@react-oauth/google?activeTab=readme guys try this library working fine. I just fixed my issue with this library.
import { useGoogleLogin } from '@react-oauth/google';
const login = useGoogleLogin({ onSuccess: async(response)=>{ try { const {data} = await axios.post('backendurl/', {'access_token':response.access_token}, { headers:{ 'content-type': 'application/json' } }) dispatch({ type :'USER_LOGIN', payload :data }) localStorage.setItem('userLoginDetails', JSON.stringify(data)) navigate(-1) toast.success('Login in Successfully ') console.log(response) } catch (error) { toast.error('Something Went Wrong') } } })
` <Button size='small' startIcon={<Box component='img' src={GoogleLogo} sx={{width:40, height:40}}/>} variant='contained' sx={{backgroundColor:'black', color:'white' , ':hover':{backgroundColor:'black'}}} onClick = {()=>{login()}}> Sign in with Google `` and call the above login function on the custom button it will work fine. Just now I fixed my stuff with this package .
in google console under Authorized JavaScript origins I added https://localhost/, And it worked for DEV
But not working in Production