Closed englianhu closed 5 years ago
You need to follow the Installation steps to generate a service credential JSON file in a Google console.
https://www.youtube.com/watch?v=zgwDQu-mCOc got the ga.aauth
key via googleAnalyticsR::ga.auth('aauth')
but not in googleLanguageR::gl.auth('gl.aauth')
> library('googleAnalyticsR')
2018-10-18 23:11:27> Default Google Project for googleAnalyticsR is now set.
This is shared with all googleAnalyticsR users.
If making a lot of API calls, please:
1) create your own Google Project at https://console.developers.google.com
2) Activate the Google Analytics Reporting API
3) set options(googleAuthR.client_id) and options(googleAuthR.client_secret)
4) Reload the package.
2018-10-18 23:11:27> Set API cache
2018-10-18 23:11:27> No environment argument found, looked in GA_AUTH_FILE
> ga_auth
function (token = NULL, new_user = FALSE, no_auto = FALSE)
{
if (!is.null(token)) {
return(gar_auth(token = token))
}
needed <- c("https://www.googleapis.com/auth/analytics",
"https://www.googleapis.com/auth/analytics.readonly",
"https://www.googleapis.com/auth/analytics.manage.users.readonly",
"https://www.googleapis.com/auth/analytics.edit", "https://www.googleapis.com/auth/analytics.manage.users",
"https://www.googleapis.com/auth/analytics.provision")
gar_auto_auth(needed, new_user = new_user, no_auto = no_auto,
environment_var = "GA_AUTH_FILE")
}
<bytecode: 0x000000000bdb72a0>
<environment: namespace:googleAnalyticsR>
> ga_auth('ga.aauth')
2018-10-18 23:12:47> No httr_oauth_cache file found at ga.aauth - creating new file.
Adding ga.aauth to .gitignore
Waiting for authentication in browser...
Press Esc/Ctrl + C to abort
Authentication complete.
Token cache file: ga.aauth
> gl_auth('ga.aauth')
Error in parse_con(txt, bigint_as_char) :
lexical error: invalid char in json text.
X (right here) ------^
> gl_auth('gl.aauth')
Error in gar_auth_service(json_file = json_file) :
file.exists(json_file) is not TRUE
> gl_auth('gl.oauth')
Error in gar_auth_service(json_file = json_file) :
file.exists(json_file) is not TRUE
> gl_auth('gl.auth')
Error in gar_auth_service(json_file = json_file) :
file.exists(json_file) is not TRUE
Ok, ignore that.
You need to create a service key there is a guide here https://cloud.google.com/video-intelligence/docs/common/auth
hey Mark,
I am having a similar problem with googleLanguageR.
2019-12-02 10:07:45> No authorization yet in this session! 2019-12-02 10:07:45> No .httr-oauth file exists in current working directory. Do library authentication steps to provide credentials. Error: Invalid token
library(googleAnalyticsR) ga_auth("ga.oauth") 2019-12-02 10:26:28> Default Google Project for googleAnalyticsR is set.
This is shared with all googleAnalyticsR users. If making a lot of API calls, please: visit: https://bit.ly/2Evk6hn for instructions on setting your own Google Project
Error: Path 'ga.oauth' does not exist
I have my json file and api key but for some reason I cannot get this authorised.
any help would be great, thanks.
Could you open this on googleAnalyticsR
repo?
https://github.com/MarkEdmondson1234/googleAnalyticsR
But looks like you need to review the setup guide on the website: https://code.markedmondson.me/googleAnalyticsR/articles/setup.html
yep but when using ga_auth() it takes me to the google webpage with an error.
Error: invalid_request Missing required parameter: client_id Learn more Request Details That’s all we know.
Ok looks like we need to see all your code you are attempting. Please open the issue on https://github.com/MarkEdmondson1234/googleAnalyticsR not here on https://github.com/ropensci/googleLanguageR
2018-10-18 22:42:25> No authorization yet in this session! 2018-10-18 22:42:25> NOTE: a .httr-oauth file exists in current working directory. Run authentication function to use the credentials cached for this session. Error: Invalid token