[英]How to access AWS API after integrated with cognito user pool
I have created API for my Lambda function and tested URL in postman, I am able to view the response. 我已经为Lambda函数创建了API,并在邮递员中测试了URL,我可以查看响应。 Now, for security purpose I have integrated Cognito user pool authorizers to my API.Now I tried to use API and getting response as below 为了安全起见,我已经将Cognito用户池授权者集成到了我的API中,现在我尝试使用API并获得如下响应
{
"message": "Unauthorized"
}
I am having App client id and App client secret for my cognito user pool.Now,I need help for authenticating the API using postman. 我的Cognito用户池具有App客户端ID和App客户端密码。现在,我需要使用邮递员身份验证API的帮助。
Depending on the specific resource method configuration you may need to send the ID Token instead of the Access Token. 根据特定的资源方法配置,您可能需要发送ID令牌而不是访问令牌。 It took some careful reading of the AWS docs Integrate an API with a User Pool . 仔细阅读了AWS文档“ 将API与用户池集成” 。 Steps 6 and 7 are the key to determine which token should be sent. 步骤6和7是确定应发送哪个令牌的关键。 A summary is: 摘要是:
If on the secured Resource Method (Method Execution step) the OAuth Scopes
setting is set to NONE
an ID Token should be sent. 如果在安全的资源方法(方法执行步骤)上, OAuth Scopes
设置设置为“ NONE
,则应发送ID令牌。 If a scope value is entered an Access Token should be sent. 如果输入了范围值,则应发送访问令牌。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.