invalid_client: The OAuth client was not found. Python

守給你的承諾、 提交于 2019-12-23 17:03:26

问题


I have an old project, that is trying to retrieve data from google analytics.

It is not working, so I am trying to figure out what's wrong.

Found an example code to work with Analytics on server side.

  scope = ['https://www.googleapis.com/auth/analytics.readonly']
  key_file_location = 'secrets.json'

  credentials = ServiceAccountCredentials.from_json_keyfile_name(key_file_location, scopes=scope)
  http = credentials.authorize(httplib2.Http())
  service = build('analytics', 'v3', http=http)

  accounts = service.management().accounts().list().execute()
  print (accounts)

It is working with secrets file for my test account. But it's not working for secrets file of an old project. I recieve the following error:

oauth2client.client.HttpAccessTokenRefreshError: invalid_client: The OAuth client was not found.

What's the problem? The secrets file is out of date? If it is, am I able to recieve another one without access to the google account?


回答1:


When you registered the application on Google developer console you created some OAuth credentials.

invalid_client: The OAuth client was not found

means that the client id you are using isn't there anymore someone probably deleted it. You will need to create new credentials.



来源:https://stackoverflow.com/questions/41568123/invalid-client-the-oauth-client-was-not-found-python

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