i'm trying to use google sign in in my nextjs application. I added the script given on the googel website the client library.This library
and another script to initialize a google sign in instance. here is my code
const handleCredentialResponse = (response) => {
console.log(response)
}
export default function App(props) {
const router = useRouter();
const { Component, pageProps } = props;
const check = router.pathname === '/watch';
return (
<ThemeProvider theme={theme}>
<Head>
<script src="https://accounts.google.com/gsi/client" async defer></script>
<script>
window.onload = function () {
google.accounts.id.initialize({
client_id: '842216765313-pk5v3gjog9nt2q4uaq7okbp8okjubfnh.apps.googleusercontent.com',
callback: handleCredentialResponse
})
};
</script>
</Head>
{/* '' */}
<MainContextProvider>
<Box sx={{ height: '100vh', overflow: 'hidden' }}>
<Navbar />
<Stack direction="row" spacing={3} sx={{ marginTop: '8px' }}>
{!check && <Drawer />}
<Component {...pageProps} />
</Stack>
</Box>
</MainContextProvider>
</ThemeProvider>
)
}
Error: it saying google is not defined.