根据新的Google Apps Marketplace 文档,为了获得用户许可的状态,向https://www.googleapis.com/appsmarket/v2/userLicense/{applicationId}/GET
发出一个简单的请求就足够了{userId}?key={ApiKey}其中applicationId
是数字、userId
电子邮件和ApiKey
直接从 Google Cloud Console 下获取的字符串APIs -> {App name} -> Server Key -> Api Key
。
我还在 Google Cloud Console 中启用了 Google Apps Marketplace API。
但是,我总是收到以下错误消息:
{"error":
{"errors":[{"domain":"global","reason":"authError","message":"Invalid OAuth header","locationType":"header","location":"Authorization"}],
"code":401,"message":"Invalid OAuth header"}}
你能帮助我吗?
编辑:按照 Arun Nagarajan 的建议,我尝试使用范围,但它仍然不起作用。这是我的代码(在 Google Appengine 上的 Python 中):
credentials = oauth2client.appengine.AppAssertionCredentials(scope='https://www.googleapis.com/auth/appsmarketplace.license')
http = credentials.authorize(http=httplib2.Http())
client = apiclient.discovery.build('appsmarket', 'v2', http=http, developerKey='XXXXXXXX')
entry = client.userLicense().get(applicationId='123456', userId='some_user@email.com').execute()