You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
✔ Setting client.id from authclient.json
[1] "name-name-123456"
ℹ 2023-07-27 18:13:35 > Using email from GARGLE_EMAIL env var: name@mail.com
Error: Could not authenticate via any gargle cred function
Execution halted
Before you run your code, please run:
options(googleAuthR.verbose=2) and copy-paste the console output here.
Check it doesn't include any sensitive info like auth tokens or accountIds - you can usually just edit those out manually and replace with say XXX this does not give any more info
packages are matching. same applies to environment variables
The text was updated successfully, but these errors were encountered:
For a server-style authentication like when within docker, I suggest you use a service account key json file instead. There are various intricacies regarding OAuth2 HTTP requests that may be blocked in your docker settings you avoid then.
What goes wrong
Authenticating GA within docker container returns described error. authenticating works on local envir
Steps to reproduce the problem
dockerfile:
start from the rocker/r-ver:4.1.2 image
FROM rocker/r-ver:4.1.2
install the linux libraries needed for plumber
RUN apt-get update -qq && apt-get install -y
libssl-dev
libcurl4-gnutls-dev
libxml2-dev
libpq-dev
libproj-dev
install packs
RUN R -e "install.packages(c('googleAnalyticsR','googleAuthR'))"
copy everything from the current directory into the container
COPY / /
when the container starts, start the main.R script
ENTRYPOINT ["Rscript", "main.R"]
Expose the container to the host's network
CMD ["--network", "bridge"]
Obtain oauth token on local machine & save as file in rds
token = googleAuthR::gar_auth() # approach 1
token = googleAnalyticsR::ga_auth() # approach 2
saveRDS('gatoken.rds')
run container with main.r below
main.R
if (!require(googleAnalyticsR)) install.packages('googleAnalyticsR')
if (!require(googleAuthR)) install.packages('googleAuthR')
autpath = r'{authclient.json}' # service account
Sys.setenv(GARGLE_EMAIL = "name@mail.com")
googleAuthR::gar_set_client(authpath)
googleAnalyticsR::ga_auth(token = readRDS('gatoken.rds'))
Expected output
Authenticated Session within docker container
Actual output
✔ Setting client.id from authclient.json
[1] "name-name-123456"
ℹ 2023-07-27 18:13:35 > Using email from GARGLE_EMAIL env var: name@mail.com
Error: Could not authenticate via any gargle cred function
Execution halted
Before you run your code, please run:
options(googleAuthR.verbose=2)
and copy-paste the console output here.Check it doesn't include any sensitive info like auth tokens or accountIds - you can usually just edit those out manually and replace with say
XXX
this does not give any more info
packages are matching. same applies to environment variables
The text was updated successfully, but these errors were encountered: