Warning: This data is provided under the Google User Data Policy. Please review and comply with the policy. Failure to do so may result in project suspension or account suspension.

Handle credential responses with JavaScript functions

You can set a JavaScript function in the data-callback attribute to handle the returned credential response. However, you cannot set both the data-login_uri attribute and the data-callback attribute. See the following code snippet:

<div id="g_id_onload"
     data-client_id="YOUR_GOOGLE_CLIENT_ID"
     data-callback="handleCredentialResponse">
</div>
<script>
  function handleCredentialResponse(response) {
      ... ...
  }
</script>