我正在使用RGA包导入GA数据。为此,我有一个预定的cron工作。多年来,到目前为止一切正常,但是我最近开始了解:
Waiting for authentication in browser...
Press Esc/Ctrl + C to abort
Please point your browser to the following url:
为什么只有在作业通过cron时才会出现。
如果我在RStudio中手动运行它,它将运行正常,没有任何问题。
代码如下:
# Load up the RGA package. This is the package that has the smarts to actually
# connect to and pull data from the Google Analytics API
Sys.setenv(HADOOP_CMD="/usr/bin/hadoop")
library(RGA)
library(rhdfs)
#Authentication
options(httr_oob_default=FALSE)
viewIds <- c( "ga:xxxxxxxx");
fileNames <- c();
token <- authorize(client.id = "ID.apps.googleusercontent.com", client.secret ="SECRET", cache = "/home/rstudio/gaToken3")
print("token in ga")
print(token)