0

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.

user2384366
  • 1,034
  • 2
  • 12
  • 28
  • There are many solutions. All of them require a Google Account - be it yours, a Service Account, or the end user (via OAuth). – tehhowch Apr 23 '18 at 19:43
  • @tehhowch: Could you direct me to some resources on how to do it using my account, then? The point here is to make the login process invisible to the app user (or to allow anonymous r/w access to the GDoc file). Right now, I settled on using Google Apps Script as described here: http://embedded-lab.com/blog/post-data-google-sheets-using-esp8266/ This approach – using the doGet and doPost method - seem to work fine. Still, it would be better to use Sheets API directly if possible. – user2384366 Apr 23 '18 at 20:51

1 Answers1

0

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).

user2384366
  • 1,034
  • 2
  • 12
  • 28