Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google API Python client error

I want to have a script for getting home feed of Google+. I use for that google's script. The client-secrets.json file is:

{
 "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 start this app, it opens a page with error and broken robot:

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

Please, help me with my problem.

like image 280
Max L Avatar asked Jun 12 '26 13:06

Max L


2 Answers

I found the solution! You should create another Client ID, but for desktop application! After that you need to use it's client_id and client_secret. It works for developing without hosting.

like image 104
Max L Avatar answered Jun 14 '26 03:06

Max L


The values you have used for client_id and client_secret correspond to a Google APIs Project that you have created and will access via

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

where XYZ is your project ID.

In this project, you'll need to make sure that http://localhost:8080/ is a redirect URI by

  1. Clicking the "APIs Access" tab on the right
  2. Finding the corresponding "Client ID for web applications" box for your app
  3. Clicking "Edit settings..."
  4. Adding http://localhost:8080/ to the "Authorized Redirect URIs" box
like image 34
bossylobster Avatar answered Jun 14 '26 03:06

bossylobster



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!