prasmussen / gdrive

Google Drive CLI Client
MIT License
8.99k stars 1.19k forks source link

fix(auth/oauth): change redirect url #665

Open BugCode1 opened 1 year ago

BugCode1 commented 1 year ago

it's the only way i find and work for now

anttiryt commented 1 year ago

Just curious, how is it supposed to work if redirect url is localhost:1? Does gdrive open a port? is it tcp port :1 ?

BugCode1 commented 1 year ago

Just curious, how is it supposed to work if redirect url is localhost:1? Does gdrive open a port? is it tcp port :1 ?

no, it's not open a port, because of deprecate OOB it can't use google url so i use localhost address and u can see the callback request data on url, then just copy the verification code from that

anttiryt commented 1 year ago

Interesting, but didn't seem to work for me either.

https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=36x-7n0vf5akeru7on6o2fjinrecpdoe99eg.apps.googleusercontent.com&redirect_uri=http%3A%2F%2Flocalhost%3A1%2FASDF&response_type=code&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&state=state

->

http://localhost:1/ASDF?state=state&code=4/0AWgavdfEU9Qp-KO9K2xhFOa7u8_KFRnn9NSLDetUHExzcM4H42giWagN2EB4oIyEXuPZcw&scope=https://www.googleapis.com/auth/drive

->

4/0AWgavdfEU9Qp-KO9K2xhFOa7u8_KFRnn9NSLDetUHExzcM4H42giWagN2EB4oIyEXuPZcw

->

Failed getting oauth client: Failed to exchange auth code for token: oauth2: cannot fetch token: 400 Bad Request Response: { "error": "redirect_uri_mismatch", "error_description": "Bad Request" }

Mine was in GCE. Maybe it has an IP REMOTE_ADDR checkup.

fachos commented 1 year ago

hi...

using version 2.1.2 now after allow button it return to

The webpage at http://localhost:1/?state=state&code=4/0AWgavde6eXXXXXXXpalmhLdZweXXXXXpvVGjS2rL-SXXXXbc9QzqJLBPA&scope=https://www.googleapis.com/auth/drive might be temporarily down or it may have moved permanently to a new web address

any solution?

thank you

fachos commented 1 year ago

ok sorry.. i understand now.....

4/0AWgavde6eXXXXXXXpalmhLdZweXXXXXpvVGjS2rL-SXXXXbc9QzqJLBPA

this is the activation code.....

thank you so much

jianshu-qin commented 1 year ago

It's worked for me. Thank you very much!