Retry-interval when an access token could not be refreshed.

321 views
Skip to first unread message

Zweitze

unread,
Oct 2, 2014, 6:23:45 AM10/2/14
to adwor...@googlegroups.com
Hi

Sometimes I get an error when I refresh an access token. See also this issue in the .NET client library.
The library maintainer comments "I don't expect to see this kind of exceptions on a regular basis". So Murphy's law kicks in and more exceptions occur:

Sep 5, 17.00h (original one)
Sep 29, 10.42h
Sep 29, 13.21h
Oct 2, 10.33h

All times are in CEST. I don't have more information because the .NET library destroyed that information.
Anyway, I decided to retry *every* kind of failure when an access token couldn't be refreshed. But what is a good retry interval?

Josh Radcliff (AdWords API Team)

unread,
Oct 6, 2014, 9:15:53 AM10/6/14
to adwor...@googlegroups.com
Hi,

I've seen some other reports of increased OAuth request failures. I'm following up with the OAuth team and will post back here once I have more information.

I recommend adding some retry logic around your OAuth requests, preferably with an exponential backoff on wait times. Others have had success using this approach.

Best regards,
Josh, AdWords API Team

Josh Radcliff (AdWords API Team)

unread,
Dec 1, 2014, 5:41:58 PM12/1/14
to adwor...@googlegroups.com
Hi,

Some improvements were made within the last few days that should have resolved this issue. Please let me know if you are still seeing frequent failures on OAuth requests.

Thanks,
Josh, AdWords API Team

Biniam Asnake

unread,
Mar 16, 2016, 10:14:16 AM3/16/16
to AdWords API Forum
We are still getting this exception.

Any solution?

Josh Radcliff (AdWords API Team)

unread,
Mar 16, 2016, 12:35:23 PM3/16/16
to AdWords API Forum
Hi,

Since this thread dates back to December 2014, it's likely that this is a separate issue. Could you provide more details, such as the errors you are encountering when trying to get an access token from your refresh token?

Thanks,
Josh, AdWords API Team

Biniam Asnake

unread,
Apr 19, 2016, 10:21:24 AM4/19/16
to AdWords API Forum
It happened again. Please help.

Here is the stacktrace.









com.google.api.ads.common.lib.exception.OAuthException: Credential could not be refreshed. A newly generated refresh token may be required.


        at com.google.api.ads.common.lib.auth.OfflineCredentials.generateCredential(OfflineCredentials.java:141)


        at com.bonial.megan.helpers.BatchProcessingServiceHelper.connectToGoogleAdwords(BatchProcessingServiceHelper.groovy:99)


        at com.bonial.megan.helpers.BatchProcessingServiceHelper.initializeAdWordsSession(BatchProcessingServiceHelper.groovy:70)


        at com.bonial.megan.services.BatchProcessingService.createAndUploadBatchJobOperations(BatchProcessingService.groovy:50)


        at com.bonial.megan.execution.actors.stateChange.mutate.StateChangeMutateActor$_onReceiveBody_closure1.doCall(StateChangeMutateActor.groovy:42)


        at com.bonial.megan.execution.actors.stateChange.mutate.StateChangeMutateActor.onReceiveBody(StateChangeMutateActor.groovy:41)


        at com.bonial.megan.execution.actors.AbstractActor.onReceive(AbstractActor.groovy:41)


        at akka.actor.UntypedActor$$anonfun$receive$1.applyOrElse(UntypedActor.scala:167)


        at akka.actor.Actor$class.aroundReceive(Actor.scala:465)


        at akka.actor.UntypedActor.aroundReceive(UntypedActor.scala:97)


        at akka.actor.ActorCell.receiveMessage(ActorCell.scala:516)


        at akka.actor.ActorCell.invoke_aroundBody0(ActorCell.scala:487)


        at akka.actor.ActorCell$AjcClosure1.run(ActorCell.scala:1)


        at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)


        at akka.kamon.instrumentation.ActorCellInstrumentation$$anonfun$aroundBehaviourInvoke$1.apply(ActorCellInstrumentation.scala:62)


        at kamon.trace.Tracer$.withContext(TracerModule.scala:57)


        at akka.kamon.instrumentation.ActorCellInstrumentation.aroundBehaviourInvoke(ActorCellInstrumentation.scala:61)


        at akka.actor.ActorCell.invoke(ActorCell.scala:483)


        at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:254)


        at akka.dispatch.Mailbox.run(Mailbox.scala:221)


        at akka.dispatch.Mailbox.exec(Mailbox.scala:231)


        at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)


        at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)


        at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)


        at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)

Josh Radcliff (AdWords API Team)

unread,
Apr 19, 2016, 2:15:45 PM4/19/16
to AdWords API Forum
Hi,

Does this always fail, or are you sometimes able to get an access token using the same exact set of credentials?

Thanks,
Josh, AdWords API Team

Biniam Asnake

unread,
Apr 19, 2016, 5:15:30 PM4/19/16
to AdWords API Forum
It happens intermittently. We have two apps that use the same refresh token and one app fails, I switch to the other one and sometimes it works.

Please help ASAP since this issues might happen at night when no body is monitoring the system.

Regards,

Josh Radcliff (AdWords API Team)

unread,
Apr 19, 2016, 5:23:26 PM4/19/16
to AdWords API Forum
Hi,

When this occurs, do you retry the request for the access token? If not, please do so with an exponential backoff policy.

Thanks,
Josh, AdWords API Team

Dorian Kind

unread,
Apr 21, 2016, 5:40:19 AM4/21/16
to AdWords API Forum
If this only happened on this specific occasion, it might have been because of Google's OAuth2 outage on that date: http://mashable.com/2016/04/19/google-oauth-down/#FjNp2S9IUgqQ

Biniam Asnake

unread,
Apr 21, 2016, 8:33:48 AM4/21/16
to AdWords API Forum
My application has a retry mechanism and I also retried manually.

Is it related to the OAuth outage? Has it happened before?

Josh Radcliff (AdWords API Team)

unread,
Apr 21, 2016, 4:49:30 PM4/21/16
to AdWords API Forum
Hi,

The OAuth issue mentioned at the beginning of this post occurred over a year ago, so it's unlikely that it's related to the errors you are seeing today.

When you retried, did it eventually succeed?

Thanks,
Josh, AdWords API Team

Biniam Asnake

unread,
Apr 28, 2016, 8:38:00 AM4/28/16
to AdWords API Forum
This issue happened again last night.

I posted a new question with "OAuthException: Credential could not be refreshed." title. It is not published yet but please take a look and reply ASAP.

Thanks.
Reply all
Reply to author
Forward
0 new messages