好吧,我按照下面的答案: Is it possible to use "Domain-wide Delegation of Authority" with gdata-python-client?
但是,当我运行我的测试时,我得到的是:
oauth2client.client.AccessTokenRefreshError: access_denied
我的代码是:
class OAuthToken():
def __init__(self, creds):
self.creds = creds
def modify_request(self, req):
if self.creds.access_token_expired or not self.creds.access_token:
self.creds.refresh(httplib2.Http())
self.creds.apply(req.headers)
def ListContacts(username):
file = open('privatekey.pem','rb')
text = file.read()
file.close()
credentials = SignedJwtAssertionCredentials('somelongnumber@developer.gserviceaccount.com',\
text,\
scope=['http://www.google.com/m8/feeds/'],\
prn=username+'@mycompany.com')
gdclient = gdata.contacts.client.ContactsClient(source='mycompany.com')
gdclient.auth_token = OAuthToken(credentials)
feed = gdclient.GetContacts()
我的其他OAuth2工具都能正常工作,只是联系人让我很难过,所以我想我已经正确设置了API&credentials。在
我在API安全性中的“一个或多个API作用域”中添加了https://www.google.com/m8/feeds/,但这似乎没有帮助。在
我可能会错过什么?在
一封小小的信就行了。在
即使身份验证路径是http://www.google.com/m8/feeds/,凭据的实际路径必须是https://www.google.com/m8/feeds/
业余的错误。对不起,各位。在
相关问题 更多 >
编程相关推荐