google-drive-upload icon indicating copy to clipboard operation
google-drive-upload copied to clipboard

Unable to access verification v4.4

Open Roei639 opened this issue 2 years ago • 9 comments

  1. Connects through a terminal by pressing gupload xxxx.json
  2. Info: Account names can only contain alphabets / numbers / dashes.
  3. Tap a backup name
  4. Refresh Token - enter
  5. Visit the below URL, follow the instructions and then come back to commandline
  6. Opening a Chrome browser and copying a link Error: This site cannot be accessed Could not connect to localhost. You should try: check the connection ERR_CONNECTION_REFUSED

Roei639 avatar Jul 23 '22 08:07 Roei639

Have you tried this script ?

https://raw.githubusercontent.com/Akianonymus/google-drive-upload/master/release/bash/gupload

If still not solved, then run with -D flag and send logs

Akianonymus avatar Jul 23 '22 13:07 Akianonymus

Doesn't work in the script you sent I can't access localhost through the terminal Is it possible? Why does it point to localhost?

Roei639 avatar Jul 23 '22 16:07 Roei639

I don't see the ERR_CONNECTION_REFUSED in logs as you said before

It is creating a localhost server to grab the code from the browser.

I will give you a new script with more debug options soon, for now run this python script and see if server is started successfully or not.

from http.server import BaseHTTPRequestHandler, HTTPServer


class handler(BaseHTTPRequestHandler):
    def do_GET(self):
        self.send_response(200)
        self.end_headers()
        if "/?code" in self.path:
            message = "Go back to command line"
            self.wfile.write(bytes(message, "utf8"))


with HTTPServer(("", 8080), handler) as server:
    server.handle_request()

Copy this to a file, let's say a.py

then, python a.py, a http server should

Visit http://localhost:8080/?code=4/0AdQt8qi-y9VMjWL7SQAxdxlbvDZr9S6NN8gqE8_9LupN4R3Cvp-r5Vc0U2VE1hSy0cZoRQ&scope=https://www.googleapis.com/auth/drive and see if a page appears in browser. Also see what is the output of the python script after visiting the url.

Akianonymus avatar Jul 24 '22 03:07 Akianonymus

log a.py:

  File "/home/pi/a.py", line 13, in <module>
    with HTTPServer(("", 8080), handler) as server:
  File "/usr/lib/python3.9/socketserver.py", line 452, in __init__
    self.server_bind()
  File "/usr/lib/python3.9/http/server.py", line 138, in server_bind
    socketserver.TCPServer.server_bind(self)
  File "/usr/lib/python3.9/socketserver.py", line 466, in server_bind
    self.socket.bind(self.server_address)
OSError: [Errno 98] Address already in use
  1. I changed port 8080 to port 9797 and the a.py script seems to work
  2. I replaced localhost with my pi address
  3. I was able to access from a browser the address you sent in the following format: http://192.168.1.253:9797/?code=4/0AdQt8qi-y9VMjWL7SQAxdxlbvDZr9S6NN8gqE8_9LupN4R3Cvp-r5Vc0U2VE1hSy0cZoRQ&scope=https://www.googleapis.com/auth/drive

How do we continue from here?

Roei639 avatar Jul 24 '22 04:07 Roei639

You were not able to open with localhost ?

Akianonymus avatar Jul 24 '22 06:07 Akianonymus

No...

Roei639 avatar Jul 24 '22 06:07 Roei639

I have same problem on v4.5. I think python http server is not working.

nextvern avatar Sep 12 '22 15:09 nextvern

Same issue here!

jkaan avatar Sep 28 '22 16:09 jkaan

~~It works for me and I get the the token after ?code= until & however when I paste in the command line, it doesn't work "Invalid refresh token".~~

I figured it out:

  1. Go to URL
  2. Keep clicking ok and login - if you see unauthorized click on go to site at the bottom left of the page, continue until the localhost page
  3. If you are doing this from a VM, change localhost in the URL to the IP address of the VM (this was the issue for me since I wasn't setting it up on my computer but on a VM so localhost would point to my computer instead of the VM)
  4. You should see the message prompt to back to CLI (you don't need to copy paste anything)
  5. In the CLI, press enter
  6. Setup the root folder for when uploading to Google Drive

Complete 🚀

I would have appreciated if it was specifically stated to go to the IP address of the VM instead of localhost:) Hope this helps someone who is also new to bash scripts

mohamed-tayeh avatar Oct 15 '22 23:10 mohamed-tayeh