Service key authentication
I'm submitting a ...
- [ ] bug report
- [ ] feature request
- [ ] question about the decisions made in the repository
- [x] question about how to use this project
Summary
I'm trying to use this package without asking an user to authenticate using a Web interface. My question here is: does it work with service keys based authentication?
Thanks you!
Hi @mateioprea !
At the moment, we don't support Service Accounts. We've actually never used them, so we're not totally sure how they should work. PRs welcome ;)
That said, is there any reason why you wouldn't want to use a standard OAuth flow (just do it once, manually) to get yourself a permanent refresh token? We've set up a helper to do this: https://refresh-token-helper.opteo.com/
Hi @avermeil!
So it works for generating a permanent refresh token?
I am also looking at the service account option as, from what I can tell (their docs aren't great) Google insists on having a G-Suite domain to create an 'Internal' OAuth consent.
@avermeil hi! Thanks for creating this library, we found it very useful. As @npearce and @mateioprea also asked it is very useful to be able to authenticate with a service account. In an internal corporate software development context, like us at brumbrum.it, it is useful to associate the credentials with a service account rather than with a real user account.
We're starting to work on this pr, we think to propose somenthing functional in the next days.
Our implementation idea start from adding a ServiceAccount type for the ClientOptions and drill down those data till GrpcClient. Doing that we will able to extend the accessTokenGetter and manage a new getAccessTokenForServiceAccount in token.ts when ServiceAccount data is set.
Make sense for you?
Regards,
Hi @alessandro-aglietti ,
Thanks for taking the time to work on this! Yes, the solution you propose sounds good :)
Hi @alessandro-aglietti,
Quick heads up about the new google ads api: it's so slow that the client that I'm working with decided to switch to adwords api.
Just a quick comparison: for pulling 10k keywords from the AdGroups takes about 30s - 1 minute while with the adwords api, it takes 4-5 seconds. :)
Hi @alessandro-aglietti,
Quick heads up about the new google ads api: it's so slow that the client that I'm working with decided to switch to adwords api.
Just a quick comparison: for pulling 10k keywords from the AdGroups takes about 30s - 1 minute while with the adwords api, it takes 4-5 seconds. :)
Yeah.. there is also a back to beta statement on https://developers.google.com/google-ads/api/docs/start. For the moment we only need the offline conversion, we didn't expect to ran in performance problems.
Anyway, thank you for the hint!
@avermeil here you find our first working version. We've some little fix (naming & docs) to be addressed before opening a PR to this main repo. In the meantime can you check if our implementation is ok for you?
Btw I've a question about the circle-ci, the project is configured to use dotenv but the yml config didn't create the .env causing failing of the build. Is ok if we update the circle-ci yml to create a .env from circle-ci envs?
At Opteo we don't use this authentication method so we do not currently support it. However we are aware that this is a desired feature so we will be looking into it in the future.
The work with refreshToken is hard when you don't need user interactions.
refreshTokens do expires.
There is an article regarding using service accounts and google ads with code snippets in some languages, https://developers.google.com/google-ads/api/docs/oauth/service-accounts
Maybe this can help.
Hi @wcoots, I have created a library about Google Ads for NodeJS and support Service Account, you can refer to it: https://github.com/htdangkhoa/google-ads https://github.com/htdangkhoa/google-ads/blob/main/src/lib/utils.ts#L5
Thanks