googleads / googleads-dotnet-lib

Google Ad Manager SOAP API .NET client library
Apache License 2.0
108 stars 198 forks source link

Refresh Token Expiring #236

Closed maricgregory closed 10 months ago

maricgregory commented 3 years ago

Hi, we’re having problems with the refresh token for one of our clients, we’re getting the response: {Error:"invalid_grant", Description:"Token has been expired or revoked.", Uri:""}.

This only seems to apply to new clients we’ve set up - this one was set up last month, previous clients are all working normally, so has something changed?

We created a new refresh token which seemed to work for a few days but then it stopped working again, we’re using the Google .NET client library so that should deal with renewing tokens?

The Google API support team have said "this seems to be more of a concern with the client library rather than the Ad Manager API"

Many thanks, Maric

christopherseeley commented 3 years ago

Hi Maric,

There are a number of reasons refresh tokens can fail: https://developers.google.com/identity/protocols/oauth2#expiration

Since this is a single client, you might want to have their administrator check their OAuth Token audit log: https://support.google.com/a/answer/6124308

This would let you know how the token was expired or revoked. There is also a Google Workplace API, so the client might have some automated process auditing / revoking unknown OAuth Tokens.

If your integration has a dedicated user in their Ad Manager network then you can also consider moving to Service Account authentication.

maricgregory commented 3 years ago

Thank you.

I asked for the OAuth token audit log, but the above link is for Google Workspaces rather than Google Ad Manager, do you know where I can get the log for Ad Manger?

Best, Maric

christopherseeley commented 3 years ago

The Google Workspaces is where the OAuth token audit log is located - it covers all OAuth not just Ad Manager. To find just Ad Manager OAuth, you can filter the audit log by the scope https://www.googleapis.com/auth/dfp.