I've created a script in R that scrapes our clients' websites robots.txt files, checks if they've changed since the last check, and uses the GmailR package to send me an e-mail if they have.
The purpose of this script is to run in the background on a schedule. Which works -- for a couple of days. Then GmailR decides that it needs to be reauthenticated, and, when Task Scheduler is running this script in the background, it just quietly errors out instead of asking me to reauthenticate.
Is anyone familiar with a way to either stay authenticated in GmailR or an alternative e-mail package that doesn't require authentication?
Here's the script I'm using for authentication:
library(gmailr)
gm_auth_configure(path = "C:/Documents/client_secret_gmail.json")
gm_auth(email = TRUE, cache = ".secret")
You can try this. It requires verification when you first time run script. You need to have json file.
gm_auth_configure(path = "~/client_secret_gmail.json")
gm_auth(email = "mymail@mail.com",
cache = gargle::gargle_oauth_cache(),
use_oob = gargle::gargle_oob_default(),)