• <legend id='bhYG3'><style id='bhYG3'><dir id='bhYG3'><q id='bhYG3'></q></dir></style></legend>
  • <tfoot id='bhYG3'></tfoot>

    <small id='bhYG3'></small><noframes id='bhYG3'>

    • <bdo id='bhYG3'></bdo><ul id='bhYG3'></ul>
  • <i id='bhYG3'><tr id='bhYG3'><dt id='bhYG3'><q id='bhYG3'><span id='bhYG3'><b id='bhYG3'><form id='bhYG3'><ins id='bhYG3'></ins><ul id='bhYG3'></ul><sub id='bhYG3'></sub></form><legend id='bhYG3'></legend><bdo id='bhYG3'><pre id='bhYG3'><center id='bhYG3'></center></pre></bdo></b><th id='bhYG3'></th></span></q></dt></tr></i><div id='bhYG3'><tfoot id='bhYG3'></tfoot><dl id='bhYG3'><fieldset id='bhYG3'></fieldset></dl></div>

        跨域 Ajax 请求 WSO2 IS

        Cross-Domain Ajax Requests WSO2 IS(跨域 Ajax 请求 WSO2 IS)
            <tbody id='5eFWP'></tbody>
          • <bdo id='5eFWP'></bdo><ul id='5eFWP'></ul>

            <legend id='5eFWP'><style id='5eFWP'><dir id='5eFWP'><q id='5eFWP'></q></dir></style></legend>

          • <small id='5eFWP'></small><noframes id='5eFWP'>

            <tfoot id='5eFWP'></tfoot>

                <i id='5eFWP'><tr id='5eFWP'><dt id='5eFWP'><q id='5eFWP'><span id='5eFWP'><b id='5eFWP'><form id='5eFWP'><ins id='5eFWP'></ins><ul id='5eFWP'></ul><sub id='5eFWP'></sub></form><legend id='5eFWP'></legend><bdo id='5eFWP'><pre id='5eFWP'><center id='5eFWP'></center></pre></bdo></b><th id='5eFWP'></th></span></q></dt></tr></i><div id='5eFWP'><tfoot id='5eFWP'></tfoot><dl id='5eFWP'><fieldset id='5eFWP'></fieldset></dl></div>
                  本文介绍了跨域 Ajax 请求 WSO2 IS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  curl -v -X POST -H "Authorization: Basic <base64 encoded client id:client secret value>" -k -d "grant_type=password&username=<username>&password=<password>" -H "Content-Type:application/x-www-form-urlencoded" https://localhost:9443/oauth2/token 
                  

                  (来自 https://docs.wso2.com/display/IS520/Resource+Owner+Password+Credentials+Grant)

                  这个'curl'命令完美运行.但是当尝试通过ajax调用它时:

                  This 'curl' command works perfectly. But when try to call it through ajax:

                    $.ajax({
                        type: 'POST',
                        data: 'grant_type=password&username=admin&password=admin',
                        headers: {
                          'Content-Type': 'application/x-www-form-urlencoded',
                          'Authorization': 'Basic  Z0hLUlA3eThYTmJydl9JR1pJemxDQ1VJQlo0YTozT2VLaUlmUVViMk1yZzZ2YU5uQVFsWFpDU29h'
                        },
                        url: 'https://localhost:9443/oauth2/token',
                        success: function(data) {
                          console.log(data);
                        }
                      })
                      };
                  

                  我收到此错误:"XMLHttpRequest 无法加载 https://localhost:9443/oauth2/token.对预检请求的响应未通过访问控制检查:请求的资源上不存在Access-Control-Allow-Origin"标头.因此,不允许访问原点"."

                  如何配置 WSO2 IS 来处理它?或者有替代方案吗?

                  I got this error: "XMLHttpRequest cannot load https://localhost:9443/oauth2/token. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access."

                  How can I configure WSO2 IS to deal with it? Or is there an alternetive for this?

                  WSO2 API Manager(WSO2 API Manager CORS)存在类似问题.但是 WSO2 IS 中没有这样的目录 '/repository/deployment/server/synapse-configs/'.

                  There is a similar issue with WSO2 API Manager (WSO2 API Manager CORS). But there is no such directory '/repository/deployment/server/synapse-configs/' in WSO2 IS.

                  推荐答案

                  这是未在 Identity Server 上启用跨源资源共享 (CORS) 时的预期行为.事实上,您可以为 Identity Server 启用 CORS.检查 [1] 以了解如何操作.

                  This is the expected behaviour when cross origin resource sharing (CORS) is not enabled on Identity Server. In fact you can enable CORS for Identity Server. Check [1] on how to do it.

                  [1] http://hasanthipurnima.blogspot.com/2016/05/applying-cors-filter-to-wso2-identity.html

                  这篇关于跨域 Ajax 请求 WSO2 IS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How to set a header for a HTTP GET request, and trigger file download?(如何为 HTTP GET 请求设置标头并触发文件下载?)
                  SmtpJs API not working! is there any way to send emails using SMTP server with JavaScript or JQuery(SmtpJs API 不工作!有没有办法使用带有 JavaScript 或 JQuery 的 SMTP 服务器发送电子邮件)
                  Get property value in JavaScript with script mediator(使用脚本中介在 JavaScript 中获取属性值)
                  set referer url with ajax request(使用 ajax 请求设置引用 URL)
                  Can HTTP headers be too big for browsers?(HTTP 标头对浏览器来说是否太大?)
                  jQuery AJAX fails to work (OPTIONS pre-flight request made) when headers are specified(指定标头时,jQuery AJAX 无法工作(OPTIONS 飞行前请求))
                  <i id='qNTwd'><tr id='qNTwd'><dt id='qNTwd'><q id='qNTwd'><span id='qNTwd'><b id='qNTwd'><form id='qNTwd'><ins id='qNTwd'></ins><ul id='qNTwd'></ul><sub id='qNTwd'></sub></form><legend id='qNTwd'></legend><bdo id='qNTwd'><pre id='qNTwd'><center id='qNTwd'></center></pre></bdo></b><th id='qNTwd'></th></span></q></dt></tr></i><div id='qNTwd'><tfoot id='qNTwd'></tfoot><dl id='qNTwd'><fieldset id='qNTwd'></fieldset></dl></div>
                    <tbody id='qNTwd'></tbody>

                    <tfoot id='qNTwd'></tfoot>

                      <bdo id='qNTwd'></bdo><ul id='qNTwd'></ul>
                      <legend id='qNTwd'><style id='qNTwd'><dir id='qNTwd'><q id='qNTwd'></q></dir></style></legend>

                      1. <small id='qNTwd'></small><noframes id='qNTwd'>