('Unexpected credentials type',None,'Expected','service_account')与oauth2client(Python) [英] ('Unexpected credentials type', None, 'Expected', 'service_account') with oauth2client (Python)
本文介绍了('Unexpected credentials type',None,'Expected','service_account')与oauth2client(Python)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图通过本指南获取Google Analytics数据:
希望有帮助!
I'm trying to get Google Analytics data with this guide: https://ga-dev-tools.appspot.com/embed-api/server-side-authorization/
def get_access_token(request):
return {'access_t': ServiceAccountCredentials.from_json_keyfile_name(
KEY_FILEPATH, SCOPE).get_access_token().access_token }
With the code above I'm trying to a create a function and return the access token to the context in my admin template.
However. I get this error I don't know what to do with:
('Unexpected credentials type', None, 'Expected', 'service_account')
What could be the issue here?
解决方案
I too was running in to this. The fix in my case was to use the correct json file. I needed to use the one that was saved when I created the service account key, not the one with the service account client:
Hope that helps!
这篇关于('Unexpected credentials type',None,'Expected','service_account')与oauth2client(Python)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文