project_shareme_social_media icon indicating copy to clipboard operation
project_shareme_social_media copied to clipboard

Please help me with this error

Open Ashutosh102 opened this issue 2 years ago • 5 comments

Uncaught Error: createIfNotExists() requires that the document contains an ID ("_id" property)

Ashutosh102 avatar Jun 23 '22 18:06 Ashutosh102

Any updates? Facing the same issue

Atharva-3000 avatar Nov 03 '22 20:11 Atharva-3000

anyone found solutions to the above issue yet....cos iv'e been facing it too

mmatrevi avatar Nov 03 '22 21:11 mmatrevi

same here any one to help please

Luluameh avatar Dec 15 '22 05:12 Luluameh

I have updated the code with new Google Authentication, you can see it below.

import React from 'react'; import { useNavigate } from 'react-router-dom'; import { FcGoogle } from 'react-icons/fc'; import { GoogleOAuthProvider, GoogleLogin} from '@react-oauth/google'; import jwt_decode from 'jwt-decode'; import shareVideo from '../assets/share.mp4'; import logo from '../assets/logowhite.png';

import { client } from '../client';

const Login = () => { const navigate = useNavigate(); const createOrGetuser = async (response) => { const decoded = jwt_decode(response.credential) localStorage.setItem('user', JSON.stringify(decoded)) const { name, email, picture, sub } = decoded; const doc = { _id: sub, _type: 'user', userName: name, image: picture, }

  client.createIfNotExists(doc)
      .then(() => {
          navigate('/', { replace: true })
      })

} return ( <GoogleOAuthProvider clientId= {process.env.REACT_APP_GOOGLE_API_TOKEN}> <div className='flex justify-start items-center flex-col h-screen'> <div className='relative w-full h-full'> <video src={shareVideo} type="video/mp4" loop controls={false} muted autoPlay className="h-full w-full object-cover" /> <div className='absolute flex flex-col justify-center items-center top-0 right-0 left-0 bottom-0 bg-blackOverlay'> <div className='p-5'> logo <div className='shadow-2xl'> <GoogleLogin render={(renderProps) => ( <button type="button" className="bg-mainColor flex justify-center items-center p-3 rounded-lg cursor-pointer outline-none" onClick={renderProps.onClick} disabled={renderProps.disabled} > <FcGoogle className="mr-4" /> Sign in with google )} onSuccess={(response) => createOrGetuser(response)} onError={() => console.log('Error')} cookiePolicy="single_host_origin" />

                      {/* {user ? (<div>Logged In</div>)
                          : <GoogleLogin
                              onSuccess={(response) => createOrGetuser(response)}
                              onError={() => console.log('Error')}
                          />
                      } */}
                  </div>
              </div>
          </div>
      </div>
  </GoogleOAuthProvider>

) }

export default Login

moinuddinrao avatar Jan 23 '23 19:01 moinuddinrao

@moinuddinrao brother please aaccept my instagram request username: rajat_katti i have lot of problems in this project i have to submit it within 3 days in college plz respond thank you

Rajath8105 avatar Feb 01 '23 15:02 Rajath8105