Coding Global Background
Coding Global
\nWhenever I try and click anything it gives me this in the console:\n VM180 client:212 Uncaught TypeError: Cannot read properties of null (reading 'parentNode')\n at mp (VM180 client:212:220)\n at Iq (VM180 client:257:135)\n at Tq (VM180 client:255:487)\n at Hq.c.port1.onmessage (VM180 client:263:156)","comment":[{"@type":"Comment","author":{"@type":"Person","name":"Deleted User","url":"https://discord.com/users/456226577798135808","image":"https://cdn.discordapp.com/embed/avatars/3.png"},"datePublished":"2023-11-07T16:46:49.904Z","text":"The error message you're seeing indicates that there is an issue with the code in the Google Sign-In button implementation. Specifically, it seems to be related to a null value being encountered while trying to access the `parentNode` property.\n\nTo debug this issue, you can try the following steps:\n\n1. Check if all the required dependencies are properly included and loaded, such as the Google Sign-In SDK.\n\n2. Verify that the HTML elements associated with the Google Sign-In button, like the container element, are correctly defined and accessible.\n\n3. Ensure that the `handleLogin` function is defined and accessible within the scope of the code snippet you shared.\n\n4. Make sure that the `client_id` parameter provided to the `window.google.accounts.id.initialize()` method is valid and matches the client ID generated for your application in the Google Cloud Console.\n\n5. Double-check the values being passed as parameters to the `fetch()` method, especially the `response.credential` and `response.client_id`. Ensure that they are valid and have the expected values.\n\nBy carefully reviewing and addressing these points, you should be able to resolve the error you encountered."}]}

Google Sign in

Archived 2 years ago
2 messages
0 members
Created 2 years ago
Updated 2 years ago
Open in Discord
T
flash
Verified
im trying to implement google sign in button but when you login it has a callback function but this happens here the code:

<script>
function googleAuth() {
function handleLogin(response) {
fetch("http://localhost:8080/api/login/", {
method: 'post',
credentials: 'include',
headers: {
'Authorization': response.credential,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"client_id": response.client_id,
}),
}).then(r => {
if (!r.ok) {
return r.text().then(text => console.log(Error during login ${r.status}: ${text}))
}
window.location.reload();
}).catch(e => {
console.log(Error during login: ${e})
});
}

window.google.accounts.id.initialize({
client_id: 'id',
callback: handleLogin,
context: 'signup',
ux_mode: 'popup',
});
return null;
}
googleAuth()

</script>
Whenever I try and click anything it gives me this in the console:
VM180 client:212 Uncaught TypeError: Cannot read properties of null (reading 'parentNode')
at mp (VM180 client:212:220)
at Iq (VM180 client:257:135)
at Tq (VM180 client:255:487)
at Hq.c.port1.onmessage (VM180 client:263:156)

Replies (2)