【发布时间】:2018-11-13 23:56:15
【问题描述】:
我正在尝试使用内置登录对话框将 Cognito 与 AWS Chalice 集成。这是我尝试过的:
# This passes in correct arn for my pool, not xxxx
authorizer = CognitoUserPoolAuthorizer(
'end_users_dev', provider_arns=['arn:aws:cognito-idp:us-west-2:xxxx])
@app.route('/test', cors=True, authorizer=authorizer)
def test():
return {"result": "Success with authorizer"}
@app.route('/test2', cors=True)
def test2():
return {"result": "Success without authorizer"}
第二种方法(test2)有效,但第一种方法(test)返回(如预期):
{
"message": "Unauthorized"
}
现在我尝试通过传入标头来进行授权测试:
Authorization: <the token I get passed in from the
built in login page callback as "id_token">
我可以手动验证 JWT 令牌内容和签名,并且用户池在 API Gateway 中显示为测试资源的“授权”,但我仍然收到相同的“未授权”消息。我错过了什么?
(注意:我也在https://forums.aws.amazon.com/message.jspa?messageID=871715#871715发了这个帖子,但是两天没收到回复)
【问题讨论】:
标签: aws-api-gateway amazon-cognito chalice