invalid_client:找不到OAuth客户端. Python [英] invalid_client: The OAuth client was not found. Python
问题描述
我有一个旧项目,正在尝试从Google Analytics(分析)中检索数据.
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.
找到了可在服务器端使用Google Analytics(分析)的示例代码.
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.
出什么问题了?机密文件已过期?如果可以,我是否可以在没有访问Google帐户的情况下再收到一个?
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?
推荐答案
在Google开发者控制台上注册该应用程序时,您创建了一些OAuth凭据.
When you registered the application on Google developer console you created some OAuth credentials.
invalid_client:找不到OAuth客户端
invalid_client: The OAuth client was not found
表示您正在使用的客户端ID不再存在,可能有人已将其删除.您将需要创建新的凭据.
means that the client id you are using isn't there anymore someone probably deleted it. You will need to create new credentials.
这篇关于invalid_client:找不到OAuth客户端. Python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!