MeshCentral icon indicating copy to clipboard operation
MeshCentral copied to clipboard

Google Drive integration failing - Error 400: invalid_request

Open soapster opened this issue 2 years ago • 9 comments

Describe the bug Trying to connect to Google drive, for autobackup

To Reproduce Steps to reproduce the behavior:

  1. Go to My server --> General --> Google Drive Backup
  2. Click on The link to the Google Drive Console
  3. Get My client ID and secret. Enter into Mesh prompt.
  4. Click link to Brows to this URL
  5. See error

Expected behavior Expect to see a login prompt to confirm connection to my account.

Screenshots 18-42 -19

18-42 -41

18-28 -00

Server Software (please complete the following information):

  • OS: Ubuntu
  • Virtualization: No
  • Network: Home LAN - Gigabit fiber
  • Version: 1.0.63 (also happened before the upgrade)
  • Node: 12.22.9

Your config.json file { "$schema": "http://info.meshcentral.com/downloads/meshcentral-config-schema.json", "settings": { "_MongoDb": "mongodb://localhost:27017/meshcentral", "cert": "sub.domain.com", "_WANonly": true, "_LANonly": true, "_sessionKey": "MyReallySecretPassword1", "webrtc": true, "AgentSignLock": true, "allowHighQualityDesktop": true, "_port": 443, "_aliasPort": 443, "_redirPort": 80, "_DesktopMultiplex": true, "_crowdsec": { "url": "http://localhost:8080", "apiKey": "theapikey - cant make this work yet", "fallbackremediation": "captcha" }, "_redirAliasPort": 80, "autoBackup": { "backupIntervalHours": 24, "keepLastDaysBackup": 14, "zipPassword": "zippassword", "googleDrive": { "folderName": "Mesh-Backups", "maxFiles": 24 } } }, "domains": { "": { "title": "Soapy's Mesh", "_title2": "Remote Support", "mstsc": true, "ssh": true, "_minify": true, "newAccounts": false, "_userNameIsEmail": true } }, "letsencrypt": { "email": "emailaccount", "names": "sub.domain.com", "skipChallengeVerification": false, "production": true } }

soapster avatar Aug 02 '22 22:08 soapster

This used to work fine. I was just randomly checking my backups, and found it hasn't updated since June 4th (I don't check often).

The only issue I had before was that the "app" on the google console was in testing. Once I "published" it, it just kept working.

I'm going to check the one at my work, to see if it is still working.

soapster avatar Aug 02 '22 22:08 soapster

Very strange... The server at work is backing up normally, without issue... I'll start poking around in the google console, and such. Will post any findings. Version at work, 1.0.50

soapster avatar Aug 02 '22 23:08 soapster

Ok, so it seems this is an issue with google???? I updated my node to v16 and it still failed. So I dug into the Google console some more. It looks like my open project was started by another app... In my case, pokemon go??? Maybe? So what I did was start a new project, specifically for Mesh. Added the OAuth consent screen, and created new credentials. Ran through the process to connect Mesh to it, and it went without a hitch.

Instead of Deleting this issue, I figured I would post details in case someone else has a similar issue.

Closing. (I wish I did these steps before even submitting the issue)

soapster avatar Aug 02 '22 23:08 soapster

Hmmm...I just went through the same thing. My setup worked for 10 days since I set it up and stopped. Looking around for the error I got (invalid grant I believe) pointed to the fact that my app was set to testing. Once I set it to Production, I got the same error you got. I recreated credentials while the app was set to production and got the same error. The last thing I did was keep it in testing, authorize meshcentral and then switch it to production. Currently it is working but I guess I'll have to wait for 10 days to check if the token will expire again.....

omriasta avatar Aug 18 '22 17:08 omriasta

So it looks like my backups stopped again. Invalid Grant. I don't understand. This is still working at my workplace, without issue. I'll have to go over my mesh and drive setup at work, to see what I am missing. Will report back what I find... If I find any differences. If anyone with experience with this integration could chime in, it would be greatly appreciated.

soapster avatar Aug 18 '22 21:08 soapster

Ok, I must have been drinking when I fix it last time. My "app" was still in testing. I did compare my work setup to my home, and I did notice a difference. Under the Credentials section of the Google API deal... 18-25 -02 I was missing a service account. I added that. Then I re-authorized mesh backup. Finally, I moved my app out of testing.

Will see what happens in a week or 2.

soapster avatar Aug 18 '22 22:08 soapster

Hmmm...I just tried that and it worked for about a week or so and I am getting this again: GoogleDrive error: Error: invalid_grant

omriasta avatar Aug 26 '22 13:08 omriasta

@soapster is this still working for you? I tried all of the above and it still stops working after a few days.....

omriasta avatar Sep 07 '22 16:09 omriasta

@omriasta Nope. Well, I did get it to authenticate, but it stopped working again. The one I have at work is still working fine though. I can't tell why that one is working. Re-authorizing it does work, if it is in testing, but not if the app is published. Then you can switch it to published after it is authenticated.

I'm out of ideas.

soapster avatar Sep 07 '22 21:09 soapster