G
G
ghostku2018-05-24 15:35:35
Python
ghostku, 2018-05-24 15:35:35

How to give the simplest console application access to the Google API?

Good day
I need a simple console application that the user would launch, it would launch the browser and authorize the user in Google, and then display the number of contacts in his Google Contacts.
Piece of my code:

SCOPE = ['https://www.googleapis.com/auth/contacts']
APPLICATION_NAME = 'ddd'
CREDENTIALS_FILE = "c:/Users/ghost/Documents/GAPI/Calls Renamer.json" 
# CREDENTIALS_FILE = "c:/Users/ghost/Documents/GAPI/Old App.json" 

storage = Storage('info.dat')
credentials = storage.get()
if not credentials or credentials.invalid:
    flow = client.flow_from_clientsecrets(CREDENTIALS_FILE, SCOPE)
    flow.user_agent = APPLICATION_NAME
    credentials = run_flow(flow, storage)

As a result, I get the following authorization error:
KsYDdRL.png
Moreover, I have an already working application of a similar type created six months ago, and if I specify its authorization file, I successfully authorize on behalf of that old application.
So, as I understand it, I have an error in the application settings in the Google Developer Console.
Can you please explain what are the required settings? What accounts and so on to register. Visually, my setting in the console does not differ from the console of the old application - but no - it does not work.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2018-05-28
@dimonchik2013

скопируйте настройки из работающего

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question