#HEADLESS #LINUX "Your authentication token has expired"

Hi @Mecha_Weasel, @maicmarin

I think the reason why the workaround didn’t work on your end is because the &access_type=offline is added to http://connect.insynchq.com/auth?cloud=gd, instead of the URL of the page that gets shown afterwards.

Looking back, we also found the workaround we provided a bit confusing and hard to follow, apologies on that. Here’s the updated and simpler version (no copy-pasting and modification needed):

  1. Remove Insync from the affected Google Account in https://myaccount.google.com/u/0/permissions

  2. Click the link below:

https://accounts.google.com/o/oauth2/auth/oauthchooseaccount?response_type=code&client_id=468017360789-e4camv9a5n4e90tk4vrpk49qonmcm95s.apps.googleusercontent.com&scope=openid%20email%20profile%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive.appdata&state=gd&redirect_uri=https%3A%2F%2Fconnect.insynchq.com%2Fauth-login&hl=en&service=lso&o2v=1&flowName=GeneralOAuthFlow&access_type=offline

  1. Google’s sign in page for Insync should appear. Select the account to be used with Insync:

  2. Use the auth code provided as needed.

1 Like

@daryll, what if I have three (3) instances of Insync Headless running under different Linux users, but all using that same Google Drive? Each is synchronizing a different sub-set of data (folders) in that Google Drive. Will that special link you provided work three (3) times? or just once?

@daryll After trying to add the account back into Insync Headless using the link you provided to generate the auth code, it does not successfully add the account. Nor does it throw any kind of (visible) error. If I do “insync-headless status” it says:

insync-headless status;
No accounts added yet. See insync-headless account add --help.

UPDATE/CORRECTION: It took several minutes, and then started showing-up under “insync-headless status”.

1 Like

After the account seemed to add successfully, it immediately throw errors again. In response to “insync-headless error list”, to showed this (now very familiar) prompt:

insync-headless error list;
1 - Your authentication token has expired. Please try logging in again.
Choose an error to resolve (1 - 1, 0 to quit): 1
1 - Login
Choose an option (1 - 1, 0 to cancel): 1

So, same symptoms as with the other link/process. Monitoring now to see if it is really synchronizing again (after responding to that re-login prompt), or just enumerating all the (tons of) files already there in the folder.

Update: 4-Hours later:

The good: Hasn’t thrown the error about the authentication token again (yet).
The bad: Status is still “SYNCING”. So, will continue to monitor to see if it completes or errors-out again.

PS: Have not (yet) tried setting-up the additional instances, just running Insync Headless under one Linux user at the moment. After the current sync finishes (or errors out again), will try the additional instances.

1 Like

Hi @Mecha_Weasel,

I have notified Daryll of your detailed updates (thank you for this!) and we will reply accordingly. Thank you very much!

Thanks. Still monitoring it. I will update when it finishes (or errors again).

1 Like

Just a quick update (13-hours in): Still in a “SYNCING” state. Hasn’t completed (to “SYNCED”) or thrown another error as of yet.

Just a another update (24+ hours in): Still in a “SYNCING” state. Hasn’t completed (to “SYNCED”) or thrown another error as of yet.

Got tired of waiting for the first Insync Headless instance to complete, so I went-ahead and setup the other two (2) similarly (using the special link provided to generate the auth code, etc.)

Rough size and count of files involved for perspective:

  • Approximately 3935 files, spread over 78 folders, representing about 27.5-GB of data.
  • Approximately 18314 files, spread over 916 folders, representing about 18-GB of data.
  • Approximately 49 files, spread over 7 folders, representing about 795-MB of data.

Here’s where things are currently at:

  • The largest one I started first, and has been running for over 24-hours - still not “completed” (to “SYNCED” status, etc.).
  • The second one is the 2nd largest, and is similar situation but with some extra errors (noted further below).
  • The third one is the smallest and generally synchronizes very quickly even if zero data was already present on local disk. Similarly, it is stuck in an forever “SYNCHRONIZING” state, never completing.

Regard the “extra” errors on the 2nd one:

  • It originally complained about some symbolic links not synchronizing, which I already dismissed (with insync-headless error dismiss-all). But, sometimes those exact errors show up again, and have to be dismissed again. I say the same errors, because its for the same exact symbolic links - not another different set of symbolic links.
  • Now it permanently says “ERROR” but no errors show-up (using either insync-headless error list -nor- insync-headless conflict list).

$ insync-headless status;
Accounts:
REDACTED@gmail.com (Google Drive)

Sync status: ERROR
(See insync-headless error list or insync-headless conflict list for details.)
No errors or actions required.

$ insync-headless error list;
No errors or actions required.

$ insync-headless conflict list;
No conflicts.

At this point no idea what the actual status of anything really is. And the “work-around” is not “working”.

@Mecha_Weasel

Hello! Thank you so much for the detailed walk-through of what has happened in the last few days, and my sincerest apologies for the continued troubles.

For the 2nd and 3rd setups, could you also please send me the latest set of log files namely:

  • logs.db
  • out.txt
  • data folder
  • live folder

Please do send them once more to support@insynchq.com with the link to this post.

Sent logs.db and out.txt for all three instances. However, the data and live folders are way too big to email.

1 Like

Understood! If and when you can, you may upload it in the cloud (i.e., WeTransfer) and send me a shared link I can access and download the files from. :slight_smile:

Done.
Sent the WeTransfer link to Support@InsyncHQ.com

1 Like

Hi @Mecha_Weasel,

Thanks for sending us the logs. Upon checking them, instances 2 and 3 are still running into the authentication token issue.

Just to confirm, were you able to perform the step below before clicking on the link? This is a necessary prerequisite to fix the issue with the non-refreshing token.

Remove Insync from the affected Google Account in https://myaccount.google.com/u/0/permissions

On top of that, please remove the said account with insync-headless account remove prior to removing it via the link above.

To summarize:

  1. Remove the affected account from Insync via insync-headless account remove
  2. Remove Insync permissions for the affected account from https://myaccount.google.com/u/0/permissions
  3. Sign in with the said account at https://accounts.google.com/o/oauth2/auth/oauthchooseaccount?response_type=code&client_id=468017360789-e4camv9a5n4e90tk4vrpk49qonmcm95s.apps.googleusercontent.com&scope=openid%20email%20profile%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive.appdata&state=gd&redirect_uri=https%3A%2F%2Fconnect.insynchq.com%2Fauth-login&hl=en&service=lso&o2v=1&flowName=GeneralOAuthFlow&access_type=offline
  4. Add the account via insync-headless account add using the auth code given after step 3
  5. Insync should start syncing

Please let us know if it works for you. Again, thank you for your patience and cooperation!

1 Like

I tried last instructions and did not work for me.

With the authorization token received in step 3 (I did the first two without issues), I tried to add the account using insync-headless but received the following message:

Sorry, an error occurred: (<HTTPStatus.BAD_REQUEST: 400>, b'{\n  "error": "redirect_uri_mismatch",\n  "error_description": "Bad Request"\n}')

When I reviewed my google account page I saw that Insynchq was not in the allowed applications

This means that, although I received a token, the application didn’t register properly in my google account.

Yes, removed the account from all three instances of Insync-Headless.
Then, removed Insync from Google Account permissions.

When I re-added the first account, I used the special link.
It said it successfully added the account, but within minutes it threw the error about logging-in again (which I did).

After that the status stayed “SYNCING” - never completing. Never changing to “SYNCED”.

Later, I re-added the account to the other two (2nd and 3rd) instances - also generating the auth code with the special link provided. The did not immediately prompt for re-login, but also are stuck “SYNCING” - forever (including the smallest one). However, later (today) the 2nd did prompt for re-login (which I did). So far, the 3rd has not thrown that error again (yet).

Obviously, I did NOT remove the Insync permissions between adding the 1st instance and adding the 2nd and 3rd instances - as that would presumably break the authentication for the 1st instance?.

In the Google Account, its NOT like it shows-up as three separate applications - its all just “Insync”.

1 Like

Hey @Mecha_Weasel and @maicmarin! I’ll forward this to our engineers and get back to you both accordingly. Thank you!

Hi all! We’ve made further improvements to simplify the steps in our solution, please refer to the steps below:

  1. Remove the affected account from all Insync instances via insync-headless account remove
  2. Remove Insync permissions for the affected account from https://myaccount.google.com/u/0/permissions
  3. Perform the headless login flow as usual.

@Mecha_Weasel @maicmarin May we ask you to please try again, this time with the three steps above? As per our Linux Team, they have already deployed a fix to web and have confirmed the steps to be working on their end. Thank you very much!

1 Like

Thanks, will try it today/tonight and update.

PS: Is there any way to clear-out logs and such between attempts? Just to be sure we’re not submitting logs from old attempts and such?