I'm trying to implement a Google log-in button on my react.js app, but can't managed to get nice results so far.
I added the script and the meta, following the doc like this:
<script src="https://apis.google.com/js/platform.js" async defer></script>
<meta name="google-signin-client_id" content="MY_CLIENT_ID.apps.googleusercontent.com">
I also added this div in my component:
<div className="g-signin2" data-onsuccess={this.onSignIn}></div>
I should have the login button, but nothing appears. I can see the div in the source code, but not the button on my app.
<div class="g-signin2" data-onsuccess="function onSignIn(googleUser) {
var profile = googleUser.getBasicProfile();
sessionStorage.setItem('authToken', profile.getId());
sessionStorage.setItem('name', profile.getName());
sessionStorage.setItem('imageUrl', profile.getImageUrl());
sessionStorage.setItem('email', profile.getEmail());
var account = this.props.cursor.refine('account');
account.refine('authToken').set(sessionStorage.getItem('authToken'));
account.refine('name').set(sessionStorage.getItem('name'));
account.refine('imageUrl').set(sessionStorage.getItem('imageUrl'));
account.refine('email').set(sessionStorage.getItem('email'));
}"></div>
I think the problem is that the script is executed before the page is rendered, so it does not replace the div by the button