googleworkspace / browser-samples

Web samples for Google Workspace APIs
Apache License 2.0
326 stars 559 forks source link

How to import the gapi library for using in a react app? #165

Open arunkumar413 opened 1 year ago

arunkumar413 commented 1 year ago

Summary

Hi Team,

I was referring this doc https://github.com/googleworkspace/browser-samples/blob/main/sheets/quickstart/index.html but it doesn't contain the information on how to include/import the gapi library.

arunkumar413 commented 1 year ago

Also the documentation isn't clear on various scopes available. How do mention the scopes if I want to create and write some data to a spreadsheet.

 ` const SCOPES = 'https://www.googleapis.com/auth/spreadsheets.readonly';`

In the below snippet is the callback a string or a function?

     function gisLoaded() {
        tokenClient = google.accounts.oauth2.initTokenClient({
          client_id: CLIENT_ID,
          scope: SCOPES,
          callback: '', // defined later
        });
        gisInited = true;
        maybeEnableButtons();
      }

Is there a detailed documentation on the methods and variables available in the two libraries referred here?

   <script async defer src="https://apis.google.com/js/api.js" onload="gapiLoaded()"></script>
    <script async defer src="https://accounts.google.com/gsi/client" onload="gisLoaded()"></script>