0

I'm executing an R script from the command line:

library(gmailr)
gmail_auth(scope = c("read_only", "modify", "compose", "full"), 
    secret_file = "C:\\Sentiment Analysis from Email in R\\client.json")

But it's asking for authentication each and every time. How to prevent this? But in RStudio, it only asks once. Please suggest a solution.

wibeasley
  • 5,000
  • 3
  • 34
  • 62
Reshu S
  • 1
  • 2
  • Did you set `options(httr_oauth_cache = TRUE)`? When you are using Rstudio presumably you are keeping the same R session alive. When you run Rscript multiple times, you are creating new R sessions each time. – MrFlick Jul 30 '18 at 14:09
  • Ya, including httr_oauth file in the same working directory solved the problem. Thank you! – Reshu S Jul 31 '18 at 15:24

0 Answers0