How do I prevent google oauth from auto signing in?
<p>This is related to this question about google plus: <a href="https://stackoverflow.com/questions/28578568/prevent-auto-sign-in-with-google-plus">Prevent auto sign in with Google plus</a></p>

<p>The difference is that I'm using the google sign in platform instead of google plus, which has a different api.</p>

<p><strong>Background:</strong></p>

<p>I have a pricing page that has a free trial signup form. The form has the google sign in button. I would like a signed in user to be able to still see the pricing page without the google sign-in causing a redirect.</p>

<p><strong>My Code</strong></p>

<p>I have the meta tag at the top of my page that identifies my application. <code>&lt;meta name="google-signin-client_id" content="MY_CLIENT_ID"&gt;</code></p>

<p>I include this script on my page:<code>&lt;script src="https://apis.google.com/js/platform.js"&gt;&lt;/script&gt;</code></p>

<p>I have this div that renders the button: <code>&lt;div class="g-signin2" data-onsuccess="onSignIn"&gt;&lt;/div&gt;</code></p>

<p>My onSignIn function looks like this:</p>

<pre><code>function onSignIn(googleUser) {
  var id_token = googleUser.getAuthResponse().id_token;

  $('#google_token').val(id_token); //hidden form value
  $('#google-oauth').submit(); //hidden form
}
</code></pre>

<p>The hidden form is submitted to the backend, where the token is used to retrieve the user's email address and name, and then creates a user account and logs them in.</p>

<p>My problem is that if the user is already signed in, google will automatically call the onSignIn function causing the form to be submitted when the page is loaded. Is there a way for me to prevent the onSignIn function being automatically called?</p>

<p>Reference: <a href="https://developers.google.com/identity/sign-in/web/sign-in" rel="noreferrer">https://developers.google.com/identity/sign-in/web/sign-in</a></p>