Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to access verification v4.4 #190

Open
Roei639 opened this issue Jul 23, 2022 · 9 comments
Open

Unable to access verification v4.4 #190

Roei639 opened this issue Jul 23, 2022 · 9 comments

Comments

@Roei639
Copy link

Roei639 commented Jul 23, 2022

  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
@Akianonymus
Copy link
Collaborator

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

@Roei639
Copy link
Author

Roei639 commented Jul 23, 2022

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?

Repository owner deleted a comment from Roei639 Jul 24, 2022
@Akianonymus
Copy link
Collaborator

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.

@Roei639
Copy link
Author

Roei639 commented Jul 24, 2022

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?

@Akianonymus
Copy link
Collaborator

You were not able to open with localhost ?

@Roei639
Copy link
Author

Roei639 commented Jul 24, 2022

No...

@nextvern
Copy link

nextvern commented Sep 12, 2022

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

@jkaan
Copy link

jkaan commented Sep 28, 2022

Same issue here!

@mohamed-tayeh
Copy link

mohamed-tayeh commented Oct 15, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants