I am setting up an automated Gmail account that will be capable of receiving, parsing, and sending emails as well as having some access to users' Google calendars. Using Google's quickstart guide for authorization I was able to get all the necessary functionality working. The problem is that it requires visiting a URL to give permissions to the program. It is not an issue when developing locally, but this will be deployed on a Debian droplet with no GUI or browser. I am guessing this could be handled by Selenium or Puppeteer, but there has to be a better way.
I have looked into Google's server-side authorization but that seems to involve visiting a URL as well. I have also come across service accounts, but there seems to be some concern over which APIs they can access and I'm not sure if it's the way to go for me.
Here are the scopes I am using:
https://www.googleapis.com/auth/calendar
https://www.googleapis.com/auth/gmail.readonly
https://mail.google.com/
Will a service account work for me? If not, what route should I be taking?