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

Missing required parameter #537

Open SultanHboush opened 2 years ago

SultanHboush commented 2 years ago

I dont why i'm getting this error!

{ "message": "Missing required parameter 'client_id'", "SQ": true }

This the code:

<GoogleLogin clientId={process.env.REACT_APP_GOOGLE_CLIENT_ID} buttonText="Log in with Google" onSuccess={handleLogin} onFailure={handleLogin} cookiePolicy={'single_host_origin'} />

Please note that the button is disabled also !

Malankar commented 2 years ago

are you using vite or create react app?

SultanHboush commented 2 years ago

@Malankar create react app

Malankar commented 2 years ago

Debuging:

Check if the name matches the name in env file First console log the env variable and see what it is giving you in the console

console.log(process.env.REACT_APP_GOOGLE_CLIENT_ID)

Alternative: For testing purpose try hard coding the value instead of referencing it via a variable because might find some other errors as well

<GoogleLogin
    clientId="Your ID"
    buttonText="Log in with Google"
    onSuccess={handleLogin}
    onFailure={handleLogin}
    cookiePolicy={'single_host_origin'}
/>
SultanHboush commented 2 years ago

@Malankar I tried it, but it gives me the same error!