Search code examples
javascriptweb-applicationsgoogle-apigoogle-api-js-client

platform.js or api.js? google api


Trying to understand how I should go about referencing the google apis for a static page web app. I am confused.

  1. I am unsure where the complete documentation is as I have stumbled upon a few broken links in this repository already
  2. These tutorial reference 2 different urls yet seem to be related to this repository

https://developers.google.com/identity/sign-in/web/reference#gapiauth2initparams

<script src="https://apis.google.com/js/platform.js?onload=init" async defer></script>

https://developers.google.com/sheets/api/quickstart/js

<script async defer src="https://apis.google.com/js/api.js"
      onload="this.onload=function(){};handleClientLoad()"
      onreadystatechange="if (this.readyState === 'complete') this.onload()">

What are the differences? what url should one use? does it matter? Should one rather use the node client rather than web and compile it?


Solution

  • https://github.com/google/google-api-javascript-client/issues/658#issuecomment-692839901

    sergentj commented

    The functionality in platform.js is a superset of the functionality in api.js. The documentation for those APIs is correct. If you are using both the sheets APIs and the sign-in API, platform.js will suffice, you needn't load both. You are correct that this is poorly documented, and we're aware that's a problem. Closing this since it is not going to be useful to track work on improving documentation (which is a much larger issue) here.