Gmailr not validating stored token in Shiny server

26 Views Asked by At

I need to send out emails automatically using R and R shiny server. I have used gmailR and the Gmail API to send out emails using the following code:

gm_auth_configure(path = "my.json")
  options(
    gargle_oauth_cache = ".secret",
    gargle_oauth_email = "[email protected]"
  )
  gm_auth(email = "[email protected]")

storing the cache in .secret. The system worked well for several months. We then had to update the email ID, so we removed the old token and generated a new token. This time the new token did not work and generates the following error:

Warning: Error in : Can't get Google credentials.
Are you running gmailr in a non-interactive session? Consider:
* Call gm_auth() directly with all necessary specifics.
53: stop
52: gm_auth
Error : Can't get Google credentials.
Are you running gmailr in a non-interactive session? Consider:
* Call gm_auth() directly with all necessary specifics.

We tried clearing the cache and generating a new one in RStudio and copying to the server: [based on this post] but it did not solve the problem. Neither the new email or the original one work with the newly generated token. Any advice welcome.

0

There are 0 best solutions below