我需要通过cron作业运行脚本:
options(httr_oob_default=FALSE)
在OOB设置为false的情况下,它仍然希望指向一个URL:
Access token will be stored in the '.ga-token.rds' file.
Waiting for authentication in browser...
Press Esc/Ctrl + C to abort
Please point your browser to the following url:
https://accounts.google.com/o/oauth2/auth?client_id=CLIENT-ID.apps.googleusercontent.com&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fanalytics.readonly&redirect_uri=http%3A%2F%2Flocalhost%3A1410%2F&response_type=code&state=LF7wyZRIeX
这是脚本的样子:
# 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)
print("going to authorize")
token <- authorize(client.id = "ID-CLIENT.apps.googleusercontent.com", client.secret ="SECRET")
print("token in ga")
print(token)
print("THE END")
print("#################################################################################")
如果我在RStudio中手动运行它,则无需指向该URL就可以正常工作并完成。为什么它通过cron作业指向URL?我该如何解决?