question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Google-sheets: unable to successfully refresh expired token

See original GitHub issue

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

  1. Create google-sheet connector using OAuth (from Settings page)
  2. create simple ingegration where google-sheet is involved
  3. After token expiration: stop integration
  4. In Connection->Google Sheets click on reconnect, you get “Successfully authorized Syndesis’s access” 5, Start integration again. Same exception in activities

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:16 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
TovaCohencommented, Mar 6, 2019

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.

1reaction
mmelkocommented, Mar 1, 2019

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Refresh Token for Project revoked after certain period
A token might stop working for one of these reasons: 1.) The user has revoked access. 2.) The token has not been used...
Read more >
Not receiving Google OAuth refresh token - Stack Overflow
When it expires you request a new token using the refresh token. See here: developers.google.com/accounts/docs/OAuth2WebServer#refresh.
Read more >
Token Expired and Scheduled Refresh Fail - Google Sheets
I will have issue of token expired and scheduled refresh fail on and off. I suspect the google sheet owner update their organization...
Read more >
Solved: OAuth Refresh token has expired after 90 days
The Microsoft documentation https://docs.microsoft.com/en-us/graph/auth-overview says that an OAuth Refresh token should only expired if it has been inactive ...
Read more >
Google Drive cannot refresh token after a few days
Google Drive backend cannot refresh the token after a few times: it will work a few times (maybe a week or more), successfully...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found