问题
I'm using the https://developers.google.com/drive/api/v3/quickstart/python to access the Google Drive Api but Google keeps throwing redirect_uri_mismatch
errors.
I add the localhost:number from the error to the Authorised redirect URIs in the client ID for the Web Application, but whenever I run the quickstart.py
, the local host number changes.
I see there are loads of questions regarding this matter on StackOverflow and I've already spent hours looking to fix mine but I haven't found an answer that seems to solve it for me.
Any ideas?
Tried answers from, amongst others,
Google Drive REST API DriveQuickstart Error 400: redirect_uri_mismatch JAVA
Google OAuth 2 authorization - Error: redirect_uri_mismatch
Error: redirect_uri_mismatch pydrive
Currently
回答1:
Tanaike's comment and answer here worked: Google APIs OAuth 2.0 redirect_uri_mismatch error
So in quickstart.py
, make the following change,
creds = flow.run_local_server(port=0)
to,
creds = flow.run_local_server(port=8080)
when http://localhost:8080/
is on the URIs list.
来源:https://stackoverflow.com/questions/63956706/google-drive-api-quickstart-py-error-400-redirect-uri-mismatch