# NOT RUN {
# }
# NOT RUN {
## in the terminal, issue this gcloud command specifying the scopes to authenticate with
gcloud auth application-default login \
--scopes=https://www.googleapis.com/auth/analytics.readonly
## access the URL, login and create a verification code, paste in console.
## view then copy-paste the access token, to be passed into the R function
gcloud auth application-default print-access-token
## In R:
gar_gce_auth_default(<token-copy-pasted>,
scopes = 'https://www.googleapis.com/auth/analytics.readonly',
cache_file = 'my_ga.auth')
# use token to authenticate as you would normally with library
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab