Authorizing AWS API Gateway requests from token in query string

蓝咒 提交于 2020-01-05 04:30:13

问题


I have API Gateway set up with a Cognito authorizer that correctly authorizes any request with the id token in the header.

This is fine when requests are XHR based as I can add the header when preparing the request. However I can't add this when using <audio src="http://api-gateway/..."> which is made directly by the browser.

The best I can do is append the token in the querystring (?token=...) but Cognito only accepts tokens in the headers.

Is there any way to get Cognito to authorize requests when they come from HTML/CSS?


回答1:


Unfortunately API Gateway does not support security tokens in query string or path parameters. I do not see this changing in the short term so would recommend replacing any hardcoded HTML elements with appropriate JS client code.



来源:https://stackoverflow.com/questions/41011489/authorizing-aws-api-gateway-requests-from-token-in-query-string

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!