为什么自定义服务帐户已获得授权但不是默认服务帐户?
为什么
from oauth2client.service_account import ServiceAccountCredentials
from apiclient.discovery import build
credentials = ServiceAccountCredentials.from_json_keyfile_name(
path_to_custom_service_acc_key, scopes)
authorized_http = credentials.authorize(Http())
build('appsmarket', 'v2', http=authorized_http)
appsmarket_api_client.customerLicense().get(
applicationId=APPLICATION_ID, customerId=domain).execute()
产生正确的回复但是path_to_default_service_acc_key
传递的相同代码会产生403 Forbidden
错误,并显示消息Not authorized to access the application ID
?
我试过
from oauth2client.client import GoogleCredentials
credentials=GoogleCredentials.get_application_default(
).create_scoped(
['https://www.googleapis.com/auth/appsmarketplace.license'])
appsmarket_api_client = build('appsmarket', 'v2',
credentials=credentials)
太。产生相同的错误。