【发布时间】:2018-10-22 05:45:16
【问题描述】:
我已经设置了 Alexa 技能来使用 Flask-Ask。 技能按预期工作正常。 现在我需要获取用户的个人信息,如姓名、电话、电子邮件、地址。所以我使用了下面的代码
@ask.intent('AskPermission')
def get_permission():
token=context.System.apiAccessToken
api_end_point=context.System.apiEndpoint
request_id=request.requestId
headers = {"Content-Type": "application/json",
# "X-Amzn-RequestId":request_id,
"Authorization": "Bearer {}".format(token)}
body = {
"version": "1.0",
"response": {
"card": {
"type": "AskForPermissionsConsent",
"permissions": [
"alexa::profile:email:read",
]
}
}
}
permission_result = requests.get('{api_end_point}/v2/accounts/~current/settings/Profile.email'.format(api_end_point=api_end_point), json=body, headers=headers)
我每次都会收到 403 响应。 我在alexa模拟器上测试它。 我已经在下面的技能中启用了权限
所以我在这里做错了什么
【问题讨论】:
标签: python-3.x alexa alexa-skills-kit alexa-skill flask-ask