I'm trying to make social login using 'react-google-login'.
.env in root
NEXT_PUBLIC_GOOGLE_CLIENT_ID=askfjaskf
Ready.tsx
import { GoogleLogin } from "react-google-login";
<GoogleLogin
clientId={process.env.NEXT_PUBLIC_GOOGLE_CLIENT_ID}
render={(props) => (
<div onClick={props.onClick}>
<div>구글 로그인</div>
</div>
)}
onSuccess={(res) => {
const { profileObj } = res as any;
setStep(AuthStep.AGREE);
}}
onFailure={(res) => {
console.log("Google Error", res);
}}
/>
And in clientId, it says
No overload matches this call. Overload 1 of 2, '(props: GoogleLoginProps | Readonly): GoogleLogin', gave the following error. Type 'string | undefined' is not assignable to type 'string'. Type 'undefined' is not assignable to type 'string'. Overload 2 of 2, '(props: GoogleLoginProps, context: any): GoogleLogin', gave the following error. Type 'string | undefined' is not assignable to type 'string'. Type 'undefined' is not assignable to type 'string'.ts(2769) index.d.ts(80, 12): The expected type comes from property 'clientId' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes & Readonly & Readonly<...>'
I don't know why it says it can be undefined. And it works on local but it doesn't work in production deployment. Anyone can help?