I am trying to create a PHP web page that requires reading some data from a google spreadsheet in my domain (I am using Google Apps Free Edition).
The spreadsheet t
What you're actually trying to accomplish is Server to Server authentication between your server and Google.
This way, when a visitor enters your page/s you'll grab data from your own spreadsheet, without any 3rd party involvement.
I'ts possible you'll find what you're looking for in Google Service Account, and here
Also, another solution (which is much easier to accomplish, but might have some set backs) is to use the oauth 2.0 protocol with your Google dev account (retrieved from Google Console API).
Refresh token are not supposed to expire, but in case it would, you can always generate it again and replace the one you had with a new one, and keep generating access tokens with it.
The major set back is in case your refresh token gets invalidated, you'll have to manually replace it, as it will require you to re-grant access to your dev account to access your spreadsheet account.
I hope this helps a bit.
Meny