Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Service Account #15

Open
willdelcast opened this issue Mar 16, 2022 · 3 comments
Open

Issue with Service Account #15

willdelcast opened this issue Mar 16, 2022 · 3 comments

Comments

@willdelcast
Copy link

I am trying to migrate my RAdwords code to rgoogleads and keep bumping into the same authentication nightmare. Some context:

Use R in my local computer, but all deployments are in a remote server that runs shiny and RStudio.
I have managed to successfully activate the service account and use it with Python's google-ads.
I have tried the same code with local OAuth2.0 and it works fine. However when I try to do so with the ServiceAccount authentication, following the documentation available at CRAN, I keep getting the same error.

This is a sample of my code:

library(rgoogleads)

gads_auth(path='../serviceAccount.json')
gads_auth(email='[email protected]',
         developer_token = '_my_dev_token_'
)
gads_set_login_customer_id('xxx-xxx-0524')
gads_get_accessible_customers()

And this is the response

<error/rlang_error>
Request had insufficient authentication scopes.
Backtrace:
  1. rgoogleads::gads_get_accessible_customers()
  2. gargle::response_process(ans, error_message = gads_check_errors2)
  8. rgoogleads:::error_message(resp)
  9. rgoogleads:::gads_abort(paste(client_id, msg))
 10. cli::cli_abort(message = message, ..., .envir = .envir)

Also, when I try gads_has_token() it returns TRUE.

@selesnow
Copy link
Owner

Hi,
Unfortunately, I have no experience with google ads api in Shiny, so I can't help. Perhaps someone else can advise.

Alternatively, you can watch Mark's video, I think the authorization process is similar.

@willdelcast
Copy link
Author

Thanks!
My main issue though is with the service account authentication, not shiny. I try to run it on the RStudio server and it fails although the service account json is properly activated (I tested it with Python). I think something in my authentication flow is wrong. Does it make sense to you?

@sshemtov
Copy link

@willdelcast I just implemented rgoogleads. Everything worked for most part when running locally in RStudio, then wasn't able to authenticate when running as a script in batch file. Not sure if this will help you but I was able to get it to work by installing the package and running the authentication lines in a terminal where the script will be running from - that way the authentication cache is stored where the script running from instead of local.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants