roleoroleo / yi-hack-MStar.gdrive

Google drive loader for yi smart ip camera (MStar based)
MIT License
27 stars 6 forks source link

Google OAuth2 changes of OOB causes drive API authorization failure, camera video upload to gdrive feature will not work #14

Open denven opened 2 years ago

denven commented 2 years ago
Error 400 invalid_request

Please check:

denven commented 2 years ago

I've just fixed the above in a simple way, use the local loop ip address as the redirect uri, not very decent, but it works. I am thinking of other grant types of OAuth2 that can be used as well, but it needs more time to update the auth flow and verify it in the bash script.

nelutzu777 commented 1 year ago

Please help with this hack, V4 https://github.com/avengermsoft/xiaomi_gdrive

denven commented 1 year ago

@nelutzu777 if you have tried this repo, please post your failure or error details here, since when I tried it last year, I fixed the authentication issue at that time.

nelutzu777 commented 1 year ago

@nelutzu777 if you have tried this repo, please post your failure or error details here, since when I tried it last year, I fixed the authentication issue at that time.

/home/yi-hack-v5 # cd /tmp/sd/ /tmp/sd # sh yi-hack/gdrive/GDriveConf Configuration is started. Wait for several seconds. Enter your Client ID: xxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com Enter your Client secret: xxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxx-RX

Put this link into your browser: https://accounts.google.com/o/oauth2/v2/auth?scope=https://www.googleapis.com/auth/drive&state=state&redirect_uri=http://127.0.0.1&response_type=code&client_id=00000000000000-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com&access_type=offline

Copy and paste your code here: 4/0AVHEtk5X-eXXXXXXXXXXXHbsi1UGQdF5D1ZS2kXXXXXXXXXXXXXXXXXn4N6WxJPMT03eh7I7l-g /tmp/sd/yi-hack/bin/./curl: line 1: syntax error: unexpected word (expecting ")") grep: /tmp/sd/yi-hack/gdrive/conf/response: No such file or directory grep: /tmp/sd/yi-hack/gdrive/conf/response: No such file or directory Your code was expired or it is not correct. Please refresh a link in your browser and enter a new valid code:

denven commented 1 year ago

@nelutzu777

I downloaded the code and setup again, the repo code still works properly although I haven't used it for the past 5-6 months. image

And I also reproduced your failure and error message below.

image

In one case, your failure is likely caused by the wrong client_id, client_secret, or generated authorization code copied during your setup, please make sure you copy the right client id and secret: image

and copy the right authorization code from your browser URL as well. If you cannot easily find the right code to copy, you can refer to and use my repo code to do it more friendly. image

In another case, if your issue persists, it may be caused by the version of your curl program or the running environment of gdrive uploader. You can try to type the below commands and paste your results here to check.

echo $PATH
echo $LD_LIBRARY_PATH
ls -lR /tmp/sd/yi-hack
curl --version
/tmp/sd/yi-hack/bin/curl --version
/tmp/sd/yi-hack/sbin/curl --version
sebzgt2k commented 9 months ago

Hello

The real question I think :-) it's how it's possible to change the folder destination like in your example "YiHome1080p" ? Thanks a lot

denven commented 9 months ago

Hello

The real question I think :-) it's how it's possible to change the folder destination like in your example "YiHome1080p" ? Thanks a lot

I think you can create a folder with your desired name in your gdive before starting the setup. Your created folder will be listed as an option for you to choose as the upload destination, check step 5 in the below screenshot.

https://github.com/roleoroleo/yi-hack-MStar.gdrive/blob/master/screenshots/02.%20console%20configuration%20of%20google%20drive%20sync%20.png

sebzgt2k commented 9 months ago

Thanks you so much I will check that

mrxyzl commented 5 months ago

Hello i also found that update the curl from the original project with the onedrive project also help with the error: grep: /tmp/sd/yi-hack/gdrive/conf/response: No such file or directory grep: /tmp/sd/yi-hack/gdrive/conf/response: No such file or directory Your code was expired or it is not correct. Please refresh a link in your browser and enter a new valid code: