UserCredential credential;       using (var stream = new FileStream("client_secrets.json", FileMode.Open, FileAccess.Read))       {         credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(             GoogleClientSecrets.Load(stream).Secrets,             // This OAuth 2.0 access scope allows for full read/write access to the             // authenticated user's account.             new[] { YouTubeService.Scope.Youtube },             "user",             CancellationToken.None,             new FileDataStore(this.GetType().ToString())         );       } 

Using the code I shared above, I can renew the duration of the refresh token and create a campaign through Google Ads SDK (for Net 5 application) without any problems, but when I launch the same application in Azure Containers, I get a "Token Expire" error.

I will be very happy if you can help me with this behavior difference. Thank you in advance.

Kind regards

Tag:google-ads-api, c#, azure, .net-core

Only one comment.

  1. Delliganesh Sevanesan

    The error ("Token Expire") shows that the Token is expired so you have to check the expiration period or create a new Token.

    You can follow the below step to Refresh auth token

    When the provider's Access token expires you need to reauthenticate the user before you use it.

    Avoid Token expiration using the GET call to the /.auth/refresh endpoint of your application.

    When App Service is invoked, the access tokens in the token store for the authorized user are automatically refreshed. Following requests for tokens from your app code, the tokens are updated. However, for a token refresh to work, your provider's refresh tokens must be present in the token storage.

    Append the access_type=offline in a query string parameter to your login API call (/.auth/login/google).

    Refer here for more information

Add a new comment.