Octoprint + Google Drive Backup. 403 Forbidden. Insufficient rights

What is the problem?

I just enabled OctoPrint backups.
Now, I'm setting up Google Drive Backup.
I have done all the steps in the documentation (created the Oauth App, downloaded the credentials JSON file), etc.

But when I search for the JSON file from OctoPrint and attach it, it does nothing.

Since I am a web developer, I have inspected and seen that in Network, and it is happening that:

Do you know why I don't have permissions to run this?
Is it because the Oauth Application has just been created in my Google Developer panel, and there is no authorization from Google? Do you have any other ideas?

What did you already try to solve it?

In addition to testing using the local domain (raspberrypi.local) I have also tested with external domains (like the one provided by octoeverywhere). And it fails the same.

I have done the "step by step" 2 and 3 times to create the Google application and get the Oauth and the credentials JSON.

Have you tried running in safe mode?

In safe mode, this plugin is not active.
"The server is currently running in safe mode. Third party plugins and language packs are disabled and cannot be enabled"

Did running in safe mode solve the problem?

No

Systeminfo Bundle

You can download this in OctoPrint's System Information dialog ... no bundle, no support!)
Attached
octoprint-systeminfo-20240102151811.zip (362.0 KB)

Additional information about your setup

OctoPrint version, OctoPi version, printer, firmware, browser, operating system, ... as much data as possible

OctoPrint Version: 1.9.3
Printer: Creality Ender 6
Firmware: Marlin2.0.1-HW-V4.3.1-SW-V1.0.4.9-BLTouch
Browser: Google Chrome (I have tried in Firefox, and in Safari)
Operation System: MacOS Monterey (12.6.8 (21G725))

The request is getting 403 from these lines: https://github.com/jneilliii/OctoPrint-GoogleDriveBackup/blob/671782188613776684a07430dc7c6749b6a944d8/octoprint_googledrivebackup/__init__.py#L35-L36. Are you by chance using a restricted login to your OctoPrint instance?

I wouldn't know how to answer that question correctly, since it is not clear to me.

My OctoPrint, yes, has a username and password to access it.
For security, when I enter my domain http://raspberrypi.local/ OctoPrint starts and asks me for a username and password.

I don't know if this answers the question. Sorry if I have not understood it correctly

Ok, I assume then that the user that is logged in is an admin user. I know that the userpermissions.can() callback is deprecated, but was still working. I can only recommend using the eraser icon in plugin manager to clear all the user settings that have been set thus far, which will do a restart of OctoPrint service. Once that is complete try re-authenticating with your json file.

I have cleared the plugin data from the Plugin Manager.
OctoPrint has been restarted
And I have tried to upload the JSON again but the same thing keeps happening.
Clicking the "Upload" button performs an action.
But below, the call to the service is executed giving the same error that I mentioned above.

The Google Drive Backup plugin does not work correctly for me

This must be something specific to bookworm or some plugin conflict somehow, I just tried on my bullseye instance that's never had it installed on before and everything works perfectly fine. I was able to upload the client secret and get an auth code, etc. Only other thing I can think of is possibly a browser extension, try in incognito mode in case something else is getting blocked?

I just tried incognito mode again (having cleared the plugin cache again). And it has failed exactly the same.

And I have tried again (and I mentioned it above) in other browsers, and the action is the same.

It is a call to a service that gives me a 403 without permissions

I'm stumped then, like I mentioned it worked exactly as expected on a brand new instance I had for testing stuff like this. I'll see about tweaking those deprecated calls to user_perissions in the future and it might fix it, but still doesn't explain why it works for me and not for you.

The same thing happens to me, I don't understand it.

I work as a Web developer, and that is why I have been able to see what actions were executed

And it's a call to a service, and the service responds with "forbidden".
So...

  • The click works
  • Loading spinner comes out (very fast)
  • Service is called
  • But it is the service itself that gives that "403 forbidden"

I don't know if it is a matter of permissions in the file when reading it (my computer is a Macbook Pro)
I don't know if it's a route issue, file name or what.

But technically the actions are executed, but the service is the one that does not allow it to continue and gives that error.

I'll see if I can test the nightly build of octopi with bookworm, this could be a larger issue with python 3.11.

So that's not it. Did a fresh image using the file 2024-01-01_2023-12-11-octopi-bookworm-armhf-lite-1.1.0.zip from the nightly downloads and after initial setup wizard installed the plugin and worked as expected.

Is it possible the JSON file is owned by a different user than the account octoprint is running under?

When I start Octoprint, I log in with a user that has been created at the "system users" level I imagine. At the OctoPrint system level.
That user is user X (a user, a nickname, not an email address)

And the Google Drive user is my personal Gmail email account.

I don't know what this connection should be like. But that question you asked seems interesting to me.

Let's see if we can direct it better.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.