Open starbasessd opened 2 years ago
See # #2611. I did point out the warning doing Obtain Key "Google will soon block apps that don’t comply with Google’s security policies ...this app should stop using unsupported OAuth flows".
I guess that has now happened.
Hi Here is the link to the OOB migration https://developers.google.com/identity/protocols/oauth2/resources/oob-migration
So it looks like all uploads to google drive now fail. Do the devs have any plans to fix this or maybe integrate something else like nextcloud or backblaze B2 https://www.backblaze.com/b2/docs/ ?
I am also facing this issue. Here is my workaround for now for others looking for a solution.
I originally ran motioneyeos but switched to running rasbian and installing motioneye. This way I could run a different tool that supports the new auth method to sync to google drive. So I dont use the "upload media" option in motioneye instead I'm using rclone.
I followed this guide to install and setup rclone besides the last couple steps about mounting your drive. I didnt need my full drive fully and permanently mounted. I then setup a cron job to run every 15 mins and use the rclone sync command to sync my cameras media directory to a folder on my google drive.
*/15 * * * * /usr/bin/rclone sync /var/lib/motioneye/Camera1/ gdrive:/cam/ --exclude lastsnap.jpg --exclude *.thumb --config /home/pi/.config/rclone/rclone.conf --verbose 2>> /tmp/rclone_cron.log >> /tmp/rclone_cron.log
This copies the files saved from "Camera1" to a folder on my google drive called "cam", excludes thumb nail files that are also saved in that directory. Also it saves a log in /tmp.
It is possible to work around this problem. I looked through a few issues related to this and I didn't seen anyone post this solution, so hopefully this will help a few people.
The only issue is that Google no longer allows the OOB redirect URI that motioneye uses. So we can just replace that with e.g. https://localhost/
and then manually copy the authorization code. We have to modify the motioneye code though, so that the application uses a valid URI when exchanging the authorization code for credentials.
We need to update these two lines:
To instead be:
'redirect_uri': 'https://localhost/',
Anyway, enough talk, here's how you do it:
# I installed motioneye using pip, your installation directory may differ.
# Here's how I find my directory:
$ pip show motioneye
Name: motioneye
Version: 0.43.0
Summary: motioneye, a multilingual web interface for motion.
Home-page: https://github.com/motioneye-project/motioneye
Author: Calin Crisan, Jean Michault, ...
Author-email: author@example.com
License: GNU General Public License v3.0
Location: /usr/local/lib/python3.9/dist-packages
Requires: pillow, babel, pycurl, boto3, jinja2, tornado
Required-by:
# So my installation directory is /usr/local/lib/python3.9/dist-packages
# Navigate to it:
$ cd /usr/local/lib/python3.9/dist-packages
# Modify uploadservices.py using an editor that you are comfortable with:
$ sudo vim uploadservices.py
# Edit the two lines as mentioned above, replace urn:ietf:wg:oauth:2.0:oob with https://localhost/
# Make sure you save the file!!
# Then restart motioneye (IMPORTANT):
$ sudo systemctl restart motioneye
If you did the steps above correctly, you should now be able to perform the authorization without error. Once you do that, you will be redirected to a non-working URL, e.g. https://localhost/?code=4/gkzLKg4b25v59dqesjma5KpNy42v2zyaMHuvpU3tVtADocDYTtjzcEkZCMWqiigVQRAmXou&scope=https://www.googleapis.com/auth/drive.file
You need to take the code
in that URL and paste it into the Authorization key
text field in motioneye. In this example my code would be 4/gkzLKg4b25v59dqesjma5KpNy42v2zyaMHuvpU3tVtADocDYTtjzcEkZCMWqiigVQRAmXou
Click the Test service
button and it should work.
Hope that helps. Enjoy! 😄
See ticket in motionEyeOS: https://github.com/motioneye-project/motioneyeos/issues/2954