Google Drive API Quickstart.py Error 400: redirect_uri_mismatch

。_饼干妹妹 提交于 2020-12-26 05:00:30

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!