google / google-api-javascript-client

Google APIs Client Library for browser JavaScript, aka gapi.
Apache License 2.0
3.22k stars 1.06k forks source link

Public API key #847

Open LindaLawton opened 1 year ago

LindaLawton commented 1 year ago

I am looking for a sample for Authorization

Which access only public data, for example public google photos directory, a public file on google drive, holiday calendars on google calendar.

From what my testing shows a client id and authorization is required. Again this is public data i don't need to be authorized to access it.

From what I can see the only way to add scopes is though

tokenClient = google.accounts.oauth2.initTokenClient({
client_id: '',
scope: SCOPES,
callback: '', // defined later
});

and the only way to add the api key is though

await gapi.client.init({
apiKey: API_KEY,
discoveryDocs: [DISCOVERY_DOC],
});

Does anyone have an example?