anthonyjgrove / react-google-login

A React Google Login Component
https://anthonyjgrove.github.io/react-google-login
MIT License
1.84k stars 427 forks source link

login button is disabled in Production #563

Open Abhinav1182 opened 1 year ago

Abhinav1182 commented 1 year ago

in google console under Authorized JavaScript origins I added https://localhost/, And it worked for DEV

But not working in Production

KasunSKarunasekara commented 1 year ago

Facing the same issue. Any solutions?

nehatkkhan786 commented 1 year ago

I am also facing the same issue guys. Did you get any alternate solution? Please help me out

asinha0609 commented 1 year ago

Facing the same issue on production, working fine for windows but MacBook.

nehatkkhan786 commented 1 year ago

https://www.npmjs.com/package/@react-oauth/google?activeTab=readme guys try this library working fine. I just fixed my issue with this library.

nehatkkhan786 commented 1 year ago

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 .