简体   繁体   中英

Is it possible to grant a JavaScript app, r/w permission to a Google Sheets file, without the need for the app user to log in/have a Google account?

I have a Google Spreadsheet file and a JavaScript application, hosted using Google Firebase free plan – if that changes anything. I would like to grant my application a read/write permission to the file so that when a user, posts something using my app, it will be written to the SpreadSheet as a new line. I thought that should be a simple scenario but…

While I got the read part running, using the API_KEY , the writing part seems to require OAuth authentication - even if the file itself is 100% public…

In my scenario the application itself should be the one, authenticating to the Sheet API - not the user of that application.

So, is there any way around this? Or to somehow log-in using OAuth on the application level?

Please note: I know I could use Firebase here, but let's just assume that for now, it is not an option.

My final solution was to use Google Apps Script instead of Google Sheets API, as described here:

https://stackoverflow.com/a/49459945/2384366

After publishing the scrip with the ' Who has access to the app ' = ' Anyone, even anonymous ' – I was able to use the doPost function to do exactly what I wanted.

Perhaps it's not the best solutions – but it works (and frankly, gives us much more control).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM