Cognito授权器中API网关中的{“消息":“未经授权"} [英] {"message":"Unauthorized"} in API Gateway in Cognito Authorizer
本文介绍了Cognito授权器中API网关中的{“消息":“未经授权"}的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我将Cognito授权者添加到API网关中定义的API时,出现{"message":"Unauthorized"}错误.我做了以下事情:
I get {"message":"Unauthorized"} error when I add cognito authorizer to my API defined in API Gateway. I did the following:
- 配置了Cognito授权者
- 在API方法中添加了授权者
- 部署了API
当我点击API网址时.我收到{"message":"Unauthorized"}错误.我想念什么吗?
As i hit the API url. I get the {"message":"Unauthorized"} error. Am I missing anything?
推荐答案
对于Cognito IAM角色,必须缺少Execute-API权限.
Execute-API permission must be be missing for the Cognito IAM role.
IAM策略示例以分配权限:
IAM Policy example to assign the permissions:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"execute-api:Invoke"
],
"Resource": [
"arn:aws:execute-api:*:*:{{APIGateway_API_ID}}/*"
]
}
]
}
这篇关于Cognito授权器中API网关中的{“消息":“未经授权"}的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文