简体   繁体   English

为WSO2 API Manager JWT Grant令牌端点配置CORS

[英]Configuring CORS for WSO2 API Manager JWT Grant token endpoint

I have a browser application that calls WSO2 API Manager JWT Grant endpoint to exchange a JWT for an access token. 我有一个浏览器应用程序,该应用程序调用WSO2 API Manager JWT Grant端点以将JWT交换为访问令牌。

The endpoint invoked from Javascript is https://WSO2APIM/oauth2/token 从Javascript调用的端点是https://WSO2APIM/oauth2/token

The problem is this call is blocked by the browser because of the CORS restriction: 问题是由于CORS限制,此调用被浏览器阻止:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://WSO2APIM/oauth2/token/ . 跨域请求被阻止:“相同源策略”不允许读取https:// WSO2APIM / oauth2 / token /上的远程资源。 (Reason: CORS header 'Access-Control-Allow-Origin' missing) (原因:CORS标头“ Access-Control-Allow-Origin”缺失)

How can I configure the CORS permission for this endpoint? 如何为该端点配置CORS权限?

.

You could enable cors by adding cors hanlder to the token endpoint 您可以通过将cors hanlder添加到令牌端点来启用cors

org.wso2.carbon.apimgt.gateway.handlers.security.CORSRequestHandler

See https://stackoverflow.com/a/35306629/1110305 参见https://stackoverflow.com/a/35306629/1110305

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM