Authenticate for Google Identity Services (GIS)

See here for the original answer.

GAPI is now being discontinued, and Google is transitioning to Google Identity Services (GIS). The new method is similar to that which was suggested by @AlexfromJitbit (Private), with some small modifications:

<html>
  <body>
    <script src="https://accounts.google.com/gsi/client" async defer></script>
    <div id="g_id_onload"
         data-client_id="YOUR_CLIENT_ID"
         data-ux_mode="redirect"
         data-login_uri="https://www.example.com/your_login_endpoint">
    </div>
    <div class="g_id_signin" data-type="standard"></div>
  </body>
</html>

This code is pulled from the new GIS example, and is recommended for all new applications as the old API will be retired as of 31 March 2023.


Tags

  1. javascript (Private)
  2. google (Private)
  3. gis (Private)
  4. gapi (Private)
  5. authentication (Private)
  6. stack-overflow (Private)
  7. answer (Private)