Building a simple react project, and wanted to add in a login page. Currently, the google login button does not appear. The div itself appears, but no button is rendered in it.
index.html
<meta name="google-signin-scope" content="profile email">
<meta name="google-signin-client_id" content="CLIENT_ID.apps.googleusercontent.com">
src/components/Login.js
import React, { Component } from 'react';
class Login extends Component {
onSignIn(googleUser) {
console.log("Signing In!")
var profile = googleUser.getBasicProfile();
document.getElementById('status').innerHTML = 'Thanks for logging in using Google, ' + profile.getName() + '!';
}
render() {
return (
<div className="socialwrapper" style={{textAlign: "center", paddingTop: 200}}>
<script src="https://apis.google.com/js/api:client.js"></script>
<div className="g-signin2" data-onsuccess="onSignIn"></div>
<div id="status">"Here is the status"</div>
</div>
);
}
}
export default Login;
Not sure what is wrong. It is that index.html isn't loaded? I've tried restarting the server, and I have double checked the CLIENT_ID is correct. The console.log in onSignIn does not trigger. Other than that, I'm not sure what to do.
<script src="https://apis.google.com/js/api:client.js"></script>tag in yourindex.htmlfirst so it's loaded before - Henkan<script src="https://apis.google.com/js/platform.js" async defer></script>", do you have it ? - Henkan