browser-samples
browser-samples copied to clipboard
How to import the gapi library for using in a react app?
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.
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>