#HEADLESS #LINUX "Your authentication token has expired"

FYI: All my Insync-Headless stuff was run under SSH also.

Main difference, is my setup is Debian as opposed to RedHat/Fedora. Not sure if that really should be a factor in any of this though? Unless there is some missing dependency, package, or configuration detail specific to RedHat/Fedora?

The only parts I did on a separate PC with a GUI was visiting that web-site to generate the auth-code, which I then pasted-in as part of the process of adding the account to Inysnc-Headless under SSH.

Here’s basically everything I did:

On the Linux server (under SSH):

  1. Removed any previous account from the Insync-Headless setup. I had actually previously removed the gMail already after the last failed attempt some time ago.

insync-headless account list;

If needed …

insync-headless account remove username@gmail.com;

On a PC with a GUI and a web-browser (Chrome in my case):

  1. Opening a new “Incognito” Window in Chrome.
  2. Signing-into G-Mail, in that “Incognito” window.
  3. Opened https://myaccount.google.com/u/0/permissions, in that same “Incognito” window.
  4. Make sure Insync is no longer listed as havving permission to that account (note: I only have 1 server though).
  5. Opened https://connect.insynchq.com/auth?cloud=gd, in that “Incognito” Window.
  6. Since it is an “Incognito” window, only the one google account should show to select, which I did select.
  7. Copying the authorization code generated in the “Incognito” window to the clipboard (and later text file) for later in under SSH.

On the Linux server (under SSH):

  1. Used the Insync-Headess CLI to add the account, using the authentication code acquired above. Like this:

    insync-headless account add -c gd -p /home/username/whateverfolder -a really-long-string-of-letters-and-numbers-here;

  2. Checked the Insync-Headless status for errors:

    insync-headless status;

  3. Verified my “selective sync” was setup the way I wanted:

    insync-headless selective-sync;

  4. Verified my automatic “conflict resolution” was setup the way I wanted:

    insync-headless conflict resolution;

  5. Periodically checked the status to make sure no errors were popping-up, and show any uploads/downloads in progress:

    insync-headless status;

PS: Regarding multiple instances:

Since I am using multiple instances of Insync-Headless, all using the same Google account, all on the same server - but, under different Linux users, I had to go back and repeat those steps a few times.

HOWEVER, I only deleted the permissions from the Google account for Insync prior to setting-up the first instance. For subsequent instances, I did generate a new authentication code for each.

1 Like

Thanks @Mecha_Weasel for the detailed instructions.

Unfortunately I am still facing the same issue.

Yeah your stuff seems like actually something up with Insync-Headless not generating some web-request to Google properly to utilize that auth code.

insync-headless account add -a XXXXXXXXXXXX -c gd -p '/home/user/Documents/Google Drive' -e MS_OFFICE
Sorry, an error occurred: (<HTTPStatus.BAD_REQUEST: 400>, b'{\n  "error": "redirect_uri_mismatch",\n  "error_description": "Bad Request"\n}')

[for Insync] Maybe some issue with the RedHat package? Some typo in something, or something there needs to be different on that distro that is not accommodated.

1 Like

Hi @maicmarin

My mistake, I misread your Insync headless version number (v3.2.6)
Can you use the provided auth code upon logging in from this link instead?
https://www.insynchq.com/auth?cloud=gd

For Insync-headless versions 3.2.7 and later, use https://connect.insynchq.com/auth?cloud=gd

1 Like