syndesis: Google-sheets: unable to successfully refresh expired token
This is a…
[ ] Feature request
[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report
[ ] Documentation issue or request
Description
After expiring acess token in integration I’m unable to reconnect from syndesis.
After clicking on “Reconnect” in google sheets connection created using oauth, I’m still getting in integration:
org.apache.camel.RuntimeCamelException: com.google.api.client.googleapis.json.GoogleJsonResponseException: 401 Unauthorized
at org.apache.camel.component.google.sheets.GoogleSheetsProducer.doInvokeMethod(GoogleSheetsProducer.java:49)
at org.apache.camel.util.component.AbstractApiProducer$1.run(AbstractApiProducer.java:86)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: com.google.api.client.googleapis.json.GoogleJsonResponseException: 401 Unauthorized
at com.google.api.client.googleapis.json.GoogleJsonResponseException.from(GoogleJsonResponseException.java:146)
at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:113)
at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:40)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest$1.interceptResponse(AbstractGoogleClientRequest.java:321)
at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1065)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:419)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:352)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:469)
at org.apache.camel.component.google.sheets.GoogleSheetsProducer.doInvokeMethod(GoogleSheetsProducer.java:47)
... 8 more
Steps to reproduce
- Create google-sheet connector using OAuth (from Settings page)
- create simple ingegration where google-sheet is involved
- After token expiration: stop integration
- In Connection->Google Sheets click on reconnect, you get “Successfully authorized Syndesis’s access” 5, Start integration again. Same exception in activities
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 16 (11 by maintainers)
Okay. I tweaked Zoran’s wording, and I am planning to add the following at the end of the introduction to the procedure for registering Syndesis as a Google client.
CAUTION Be careful if you choose to use the Google client ID and Google client secret that you are using for some other, non-Syndesis, OAuth client. Syndesis requires offline access that is requested on the first OAuth exchange. If another OAuth client already entered the OAuth exchange and did not request offline access, then Syndesis cannot obtain offline access on subsequent OAuth exchanges. If you are unsure whether offline access was requested on the first exchange, create a new Google client ID and secret for Syndesis.
@christophd So if I understand this correctly, user would need to create new credentials dedicated to syndesis integration prior first api call to receive refresh token. If user wants to use existing credentials he shouldn’t create connection using oauth flow and specify refresh token. I guess that make sense.
It is mandatory to recreate the client ID on the Google Developers account before the Google Sheets connection in Syndesis is created. This is because the Google Developer API provides the refresh token only once. When the refresh token has already been delivered in a previous OAuth request all further requests for the refresh token will be ignored by Google. This is basically why the refresh is not working.
The reconnect is successful because the client ID itself is still valid.
I tested that with a new client ID on my Google Sheets Developer account and created a fresh connection within Syndesis with that client ID. My integration is now running for hours and successfully refreshing the access tokens. When I remove the connection settings and reuse the client ID in a new connection the refresh is not working anymore.
This is a known limitation according to what I have been told.
Thanks @zregvart for pointing to this