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

GoogleAdsClient always generates new access token #118

Closed
AdrianPell opened this issue Sep 9, 2019 · 4 comments
Closed

GoogleAdsClient always generates new access token #118

AdrianPell opened this issue Sep 9, 2019 · 4 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers P2 usability This issue is related to a usability issue with the client library.

Comments

@AdrianPell
Copy link

In the Google Adwords API, there was a callback in the authentication flow (on OAuth2ProviderForApplications) which would be called whenever an access token was refreshed, and also a call to refresh the access token if needed. We used this because we made many independent calls to the Adwords API and cached the access token to avoid the overhead of refreshing.

In the Google Ads API, it seems that the implemented behavior is to always start by obtaining an access token from the given refresh token. Indeed, any access token passed into the client through the GoogleAdsConfig is ignored with only the refresh token used to initialize the UserCredential.

Furthermore, there's no way to hook the activity on the UserCredential because only an ICredential is exposed, and I can't override this because there's no available interface on GoogleAdsConfig.

So ...

  1. Is it reasonable to refresh access tokens frequently? What's the overhead (presumably at least a server round-trip)? In our case, we might be doing this many, many times as the clients are created in Azure functions ... It's even possible that many of these refreshed access tokens might be used concurrently. Is that a problem?
  2. Alternatively, is there a way to hook that refresh activity?
@AdrianPell
Copy link
Author

@AnashOommen Any thoughts on this one?

@AnashOommen
Copy link
Member

Hi Adrian,

I'll get you a fix for this issue in the next push.

@AnashOommen AnashOommen self-assigned this Jan 6, 2020
@AnashOommen AnashOommen added enhancement New feature or request good first issue Good for newcomers P2 usability This issue is related to a usability issue with the client library. labels Jan 6, 2020
@AdrianPell
Copy link
Author

Thanks Anash!

@AnashOommen
Copy link
Member

Hi Adrian,

With v2.7.0, you should be able to extend GoogleAdsConfig class and add your own logic for refreshing credentials. Let me know if that works for you.

AnashOommen added a commit that referenced this issue Apr 6, 2021
commit ab22a1b651a4a0630c9c84960e2257efe0c4ba69
Author: AnashOommen <adwordsapiadvisor+anash@google.com>
Date:   Tue Apr 6 17:49:28 2021 -0400

    merge GitHub master into the release branch

    Change-Id: I5c88de14b8cc218fbcbe9163dbab8e41542faa7a

commit 8288526a17c01f1f14294b8c5fafa02b8d364998
Author: AnashOommen <adwordsapiadvisor+anash@google.com>
Date:   Tue Apr 6 16:26:15 2021 -0400

    Bump the library version + one dependency that was missed in another CL.

    Change-Id: Ic06cc2269ab32b846e72e39125074efbc7aa130c

commit be6b11ebf645f490ba022f9d73624340ba6ce1e7
Author: AnashOommen <adwordsapiadvisor+anash@google.com>
Date:   Tue Apr 6 12:02:00 2021 -0400

    Regen all stubs.

    Change-Id: Ia777117e2ee882b9dd48fa246afe4fefa22e729a

commit 3814e68aac0b85900cdc080263eb6deb8ee87c19
Author: AnashOommen <adwordsapiadvisor+anash@google.com>
Date:   Tue Mar 30 12:29:36 2021 -0400

    Limit the scope of cache from global to client level. Provide a flag to control the channel cache.
    By default, the channel cache is ON, and it has to be disabled by anyone who overrides the client
    library's mechanism for auth credential management.

    This fixes #262, which became an issue
    when #118 was fixed.

    Change-Id: Ib58c90e9add1bc1921cabd0042fe96e6a1e51082

commit 72fab3f47358d93e6a263e78b7c0b44336ef82f0
Author: AnashOommen <adwordsapiadvisor+anash@google.com>
Date:   Fri Mar 26 16:27:04 2021 -0400

    Add a code example for setting custom timeout. Regen ServiceHelperMethods.cs using the template from cl/365265552

    Change-Id: I55678cdebe18023111b97f4d7c2d8ff4563f7f70

commit 789c28ca98cada8d1604d9ae37f4f448c4c8f04e
Author: AnashOommen <adwordsapiadvisor+anash@google.com>
Date:   Wed Mar 24 17:15:54 2021 -0400

    Fix all outdated documentation links. Fixes b/182994224

    Change-Id: Icd936ec4dea17b63fc37f3a983d5dfcf9d50bd1e

commit 1cfbdd3712fbeb958a19190916f6af7d02f6bda8
Author: AnashOommen <adwordsapiadvisor+anash@google.com>
Date:   Wed Mar 24 17:33:52 2021 -0400

    Bump library dependencies. Fixes b/182993872

    Change-Id: If17f7e842e9cceb38bb75486a9126167c2e2513d

commit 9e55d748932c2c4d56effbc5e663fdebeee2ab47
Author: AnashOommen <adwordsapiadvisor+anash@google.com>
Date:   Wed Mar 24 17:20:13 2021 -0400

    Remove HasPartnersBadge from CreateCustomer.cs. Fixes b/182994006

    Change-Id: I629c8972de6f506987c2934a16a6314dcb0291ec

commit ccfc5eb8cfb71163519d725394a5d1d4def8ea70
Author: AnashOommen <adwordsapiadvisor+anash@google.com>
Date:   Wed Mar 24 16:15:24 2021 -0400

    Remove support for language_code and domain_name from AddDynamicPageFeed.cs

    Change-Id: I576c53cabca917568867f544ea1bff775b478a4c

commit 6c80d0ea64df6dfe036f06179a4bd517399aa775
Author: AnashOommen <adwordsapiadvisor+anash@google.com>
Date:   Mon Mar 8 14:20:17 2021 -0500

    Add support for .NET 5.0 and make it the default version for tests.

    Fixes b/182995980

    Change-Id: I4488844db6c0b6454d2f9a2f9f6d37fd2c8b3e55

commit 4c4695c555f51b26a6aa1a770e24f753c616e20f
Merge: b87ac858 83eba84
Author: AnashOommen <adwordsapiadvisor+anash@google.com>
Date:   Wed Mar 24 15:07:30 2021 -0400

    Merging GitHub master into GoB internal_v6_1

    Change-Id: Ibc8ab2cde1171beaa23cf227d0fa0d21a2eec2f0

commit b87ac8583b7786a06ec1270abfea4c30534604fe
Author: AnashOommen <adwordsapiadvisor+anash@google.com>
Date:   Wed Feb 10 13:22:50 2021 -0500

    Bump the version and changelog. Do not submit until releases are done, stubs are regenerated
    and all other pending CLs are submitted.

    Change-Id: Ief79c9788abec1aa85fe983c7352027b199e77ed

commit b4adf69316d9e34ab00f53eb6d528e544035647b
Author: Anash P. Oommen <anash@ad.corp.google.com>
Date:   Thu Feb 11 12:02:49 2021 -0500

    Support multiple OAuth2 scopes in GoogleAdsConfig

    Change-Id: I7deeda1e072d1fc64254fb07dfe69bead39c3117

commit c4e14d18e32e1ce87342c75d27934abe1ade138b
Author: Anash P. Oommen <anash@google.com>
Date:   Thu Feb 11 12:56:17 2021 -0500

    Fix the stubs to hide autogenerated service builder methods.
    Change file mode to 644.
    Some extra files may be changed in v4 and v5 due to the newer grpc stub surface.
    This is transparent to the user.

    Change-Id: Ie1658b165ee0c8b9d3403217f8a48f56a76d25f3

commit dea89137595ab9478c3a8bac7d3175c250fd8e0e
Author: Anash P. Oommen <anash@google.com>
Date:   Thu Feb 11 11:16:32 2021 -0500

    Regen stubs after v6_1 release. Fixes b/177985127

    Change-Id: I7f912cb0a3faf5e3366837a7dab225c2cbddda06

commit dce01f013df5f26393c2f7272dc3786005e82d76
Author: AnashOommen <adwordsapiadvisor+anash@google.com>
Date:   Wed Feb 10 20:01:00 2021 -0500

    Fix the build script to include AuthenticateInWebApplication project

    Change-Id: Iff6a5efb856a20e1944395059fa412a484302a00

commit 14e071b2b45b3e1e247ab2959e98518e49fb2c13
Author: Anash P. Oommen <anash@ad.corp.google.com>
Date:   Wed Feb 10 11:04:19 2021 -0500

    Add a new ASP.NET Core + Razor templates example for Google Ads API. This supercedes the old ASP.NET + WebForms example which is still maintained as part of the distribution.

    Change-Id: I88d24708bb800d13b5cdfc2e74d93d8628e6c703

commit 250274ff3f8a5eec1d0091fa039f61199390ec22
Author: AnashOommen <adwordsapiadvisor+anash@google.com>
Date:   Tue Feb 9 16:31:04 2021 -0500

    Bump grpc deps. Fixes b/177985439

    Change-Id: I707c47bbcb17692116926d4601225194eae8bd24

commit 52747c9a723ee362567a2a0a2df4a5d867755a3c
Author: AnashOommen <adwordsapiadvisor+anash@google.com>
Date:   Mon Feb 8 15:06:21 2021 -0500

    Fix the invitations example and add start/end tags for the guide.

    Change-Id: I1d18d7676a8f55bd1bc89138f19c90d278bba98b

commit dc977dac37d870e5aeeed372a952a9f3519de266
Author: Anash P. Oommen <anash@ad.corp.google.com>
Date:   Mon Feb 1 14:50:21 2021 -0500

    Add a code example for image extensions. Fixes b/177988303

    Change-Id: I054c4adb40518ee986340fc0b0b88eb660dfaa93

commit 133573b71e5d5fdcdb3365942f4391d62df82038
Author: AndrewMBurke <amwb@google.com>
Date:   Mon Feb 8 11:56:48 2021 -0500

    Fix for AddCampaignBidModifier example. Fixes b/179604678

    Change-Id: I38fa6fea62117683d1a861d17587c5e8153c1c3f

commit d807fe3688db746b271ad3483c3cc50c2750b6c7
Author: Anash P. Oommen <anash@google.com>
Date:   Thu Feb 4 11:57:32 2021 -0500

    Regen for Feb 4

    Change-Id: I3dc7a908bc102bea4e926e531d0c49ea29c8d0a4

commit 3c76eb93eae1726faf2fd633d27652fc28b92dbb
Author: Anash P. Oommen <anash@ad.corp.google.com>
Date:   Mon Feb 1 12:11:35 2021 -0500

    Fix the GetChangeDetails.cs example. Fixes b/177987511.

    Change-Id: Id244e0496ca4f2eadde7d889d91c5e95da9e0399

commit 002aaa182c831af1f267e79f7c4c24a85f74a317
Author: Anash P. Oommen <anash@ad.corp.google.com>
Date:   Mon Feb 1 12:28:36 2021 -0500

    Fix the AddCampaignBidModifier.cs example to show mutable response. Fixes b/177988306

    Change-Id: I3f2d4e0bc6b04dd4edffda5ff929c848f30216d4

commit eaf3f4378fd1abb2e2444e9dff718750f9c3c93c
Author: Anash P. Oommen <anash@ad.corp.google.com>
Date:   Wed Feb 3 11:23:38 2021 -0500

    Rename the existing web application to AuthenticateInAspNetWebApplication. A newer ASP.NET Core application follows in another CL.

    Change-Id: Ided1103db438c92732ff2a6fb01c05ed9018b121

commit f42008f69498a0a673475819465548748e32f9e4
Author: Anash P. Oommen <anash@ad.corp.google.com>
Date:   Fri Jan 29 16:50:52 2021 -0500

    Fix invitation example comments and a minor bug. Fixes b/177987757

    Change-Id: I469c8be6680fa03cba7217d859faa71999e04cc5

commit 3f3d416e92bc665ae6d4fcd2c0efb3c460a5e184
Author: Anash P. Oommen <anash@google.com>
Date:   Fri Jan 29 14:28:57 2021 -0500

    Regen stubs for 1/29

    Change-Id: Ie1eadb4ba0ec372bfbffda79f6ff558f8dc36bf7

commit d2f5166abb1301c900a3ba07721de9bb5362dfe5
Author: Anash P. Oommen <anash@ad.corp.google.com>
Date:   Fri Jan 29 16:08:40 2021 -0500

    Do a apt-get update before apt-get install.

    Change-Id: I202dc917e8a4f66a147dccd978e65360be45085a

commit 401ade41ce64633f4d4abe2081e5581c3b3043fe
Author: Anash P. Oommen <anash@ad.corp.google.com>
Date:   Tue Jan 26 09:18:22 2021 -0500

    Add an additional log masking for invitation email address in gaql.
    Fixes b/178350997

    Change-Id: Iddad74bb5fc545ab5411bfaff823cfab835b1d24

commit 6c8d0400f0958e40ead1a95e1f73d87bfedb042c
Author: Anash P. Oommen <anash@ad.corp.google.com>
Date:   Tue Jan 26 12:02:35 2021 -0500

    Fix the links in AddDisplayUploadAd.cs. Fixes b/178168135

    Change-Id: Id400481be6fd9ee6d9881d0cd1dcfa7b228e77ee

commit 98cac0161826a71ee92280678bff13eaf5c92fd2
Author: Anash P. Oommen <anash@ad.corp.google.com>
Date:   Mon Jan 25 14:12:28 2021 -0500

    Add new code examples for user invitation.
    Fixes b/177987757

    Change-Id: I83864f1e8be802be04b7d14758040bd00557f106

commit 680dedcef436520fee54d2efa81fb309b395836a
Author: Anash P. Oommen <anash@ad.corp.google.com>
Date:   Mon Jan 25 13:06:43 2021 -0500

    Remove support for v3.

    Change-Id: I7a3f23646f9c82ebee5357d70766a82288ea0d11

commit a652e05fc2ec7b068548d8207b21bd5792c113ca
Author: Anash P. Oommen <anash@ad.corp.google.com>
Date:   Fri Jan 22 14:24:48 2021 -0500

    Add a resourcename method for CustomerUserAccessInvitation resource.

    Fixes b/177984849
    Fixes b/177984652

    Change-Id: Ie7fc76fe51559444c1088f143bc2eb2b477a15cd

commit bac8b94b9ce08f4eb85ace613fd6654527a0b483
Author: Anash P. Oommen <anash@ad.corp.google.com>
Date:   Fri Jan 22 13:49:23 2021 -0500

    Add logs masking for CustomerUserAccessInvitation

    Change-Id: Ibfc3ec2f2848720df289c7cec877680df7e582c3

commit 730fca77a0ae42667005465731e2eddba2eef392
Author: Anash P. Oommen <anash@google.com>
Date:   Fri Jan 22 13:11:44 2021 -0500

    Regen stubs on Jan 22

    Change-Id: I46b4567fb28d3ed4303e6a60875d150609ba6011

commit 479aea26a6bdeddabf2f49ecf5221f32c9de7fc5
Author: Anash P. Oommen <anash@google.com>
Date:   Tue Jan 19 16:49:25 2021 -0500

    Regen stubs for v6.1

    Change-Id: Ie820333bc51adf46198857de37c47e897343ada3

Change-Id: I792c72d617e6209d05bfde8477dc442ffe11056a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers P2 usability This issue is related to a usability issue with the client library.
Projects
None yet
Development

No branches or pull requests

2 participants