Google API Python client error

I want to have a script to get a Google+ home feed. I am using google script for this . Client-secrets.json file:

{
 "web": {
   "client_id": "##########",
   "client_secret": "############",
   "redirect_uris": ["http://localhost:8080/oauth2callback/"],
   "auth_uri": "https://accounts.google.com/o/oauth2/auth",
   "token_uri": "https://accounts.google.com/o/oauth2/token",
   "client_email":"##########@developer.gserviceaccount.com",
   "javascript_origins":["http://localhost:8080/"]
        }
}

      

But when I want to run this application, it opens an error page and a broken robot:

The redirect URI in the request: http://localhost:8080/ did not match a registered redirect URI

Please help me with my problem.

+3


source to share


3 answers


I found a solution! You have to create a different Client ID, but for the desktop app! After that, you need to use client_id and client_secret . It works for development without hosting.



+10


source


The values ​​you used for client_id

and client_secret

correspond to the Google API project you created and will be accessed via

https://code.google.com/apis/console/?pli=1#project:XYZ

where XYZ

is your project id.



In this project, you need to make sure the http://localhost:8080/

redirect URI is

  • Clicking on the "API Access" tab on the right
  • Search for the appropriate "Web Application Client ID" for your application.
  • By clicking "Change settings ..."
  • Adding http://localhost:8080/

    to the Authorized URI Redirects field
+1


source


Running a local server on port 80 and generating the config urls just http://localhost

fixed it for me.

eg. for your case

{
 "web": {
   "client_id": "##########",
   "client_secret": "############",
   "redirect_uris": ["http://localhost/oauth2callback/"],
   "auth_uri": "https://accounts.google.com/o/oauth2/auth",
   "token_uri": "https://accounts.google.com/o/oauth2/token",
   "client_email":"##########@developer.gserviceaccount.com",
   "javascript_origins":["http://localhost"]
        }
}

      

0


source







All Articles