【问题标题】:denied due to lack of policy file permissions由于缺少策略文件权限而被拒绝
【发布时间】:2011-01-02 09:17:09
【问题描述】:

我无法获取我的 Yahoo!即使他们的策略文件接受来自任何域的请求,我也一直被拒绝访问。

OK: Policy file accepted: http://social.yahooapis.com/crossdomain.xml
Error: Request for resource at http://social.yahooapis.com/v1/user/<user id>/profile?oauth_signature_method=HMAC-SHA1&lang=en-US&oauth_consumer_key=<key>&oauth_token=<long ass token>&oauth_version=1.0&format=json&oauth_nonce=<blah blah>&oauth_timestamp=1262846353&region=US&oauth_signature=<foo bar> by requestor from http://<my domain>/YOSSimple.swf is denied due to lack of policy file permissions.

顺便说一句,网址有效,我编辑了一些东西,因为它有我的钥匙和东西。


链接到我正在尝试做的事情

http://developer.yahoo.com/flash/yos/
http://developer.yahoo.com/flash/yos/examples/simple/YOSSimple.fla

YOSSimple 实际上正确地创建了 url,因为如果我在浏览器中键入它,系统会提示我是否要下载包含有关我的个人资料的信息的文件。

但它只是不会在 Flash 中打开它。

【问题讨论】:

  • 你是什么安全沙箱?尝试使用本地受信任,因为我没有看到跨域策略文件有任何问题。
  • 顺便说一句,我正在使用 CS4。我已经将它的发布设置设置为Access network only,但它仍然不起作用。
  • 您能发布执行失败请求的代码吗?

标签: actionscript-3 flash yahoo flash-cs4


【解决方案1】:

我猜它不会自动加载策略文件。你应该尝试使用 Security.loadPolicyFile("http://social.yahooapis.com/crossdomain.xml");

您是否安装了 webproxy,您可以使用它来监控究竟加载了哪些文件?我最喜欢的是Charles,但也有免费的FF插件,比如Httpfox

编辑: 我想我知道出了什么问题。反过来就出错了,来自雅虎的 swf 正在尝试访问您的 swf,但没有正确的权限。你会试试

Security.allowDomain( 'http://social.yahooapis.com/' );

【讨论】:

  • 已经尝试手动加载策略,还是不行。过一会儿就会尝试那个 webproxy 的东西。
  • 文件在那里加载没有问题。 [social.yahooapis.com/crossdomain.xml、YOSSimple.swf 等]。它说它在 XML 之前先加载 SWF,这会是问题吗?
  • 不,应该是这样。顺便说一句,我编辑了我的答案,我想我知道出了什么问题。
  • 哎呀! :-) 那么我没有想法......如果你找到它,你能发布解决方案吗?我现在真的很好奇!
  • 如果我曾经这样做 :( 但我有点继续前进,我改用他们的 PHP SDK=..=
【解决方案2】:

http://www.ieinspector.com/httpanalyzer/

使用 HTTP 分析器查看发生了什么?

还要检查您的不匹配 http://www。使用 http://,因为 flash 将它们视为不同的域

您是否也在您的机器上本地运行代码。可能是您的本地安全设置

【讨论】:

    【解决方案3】:

    一个简单的 WebProxy 可以解决这个问题:

    <?php
        // PHP Proxy
        // Loads a XML from any location. Used with Flash/Flex apps to bypass security restrictions
        // usage: proxy.php?url=http://mysite.com/myxml.xml
    
        $session = curl_init($_GET['url']);                    // Open the Curl session
        curl_setopt($session, CURLOPT_HEADER, false);          // Don't return HTTP headers
        curl_setopt($session, CURLOPT_RETURNTRANSFER, true);   // Do return the contents of the call
        $xml = curl_exec($session);                            // Make the call
        header("Content-Type: text/xml");                  // Set the content type appropriately
        echo $xml;        // Spit out the xml
        curl_close($session); // And close the session
    ?>
    

    【讨论】:

      【解决方案4】:

      修改上面的网络代理示例以支持多个选项,如下所示:

      $sOptions = "";
      
      foreach($_GET as $sIndex => $sValue) {
        if ($sIndex == 'url') {
          $url = $sValue;
        } 
        else {
          if (strlen($sIndex) > 0) {
            $sOptions .= "&" . $sIndex;
          }
          if (strlen($sValue) > 0) {
            $sOptions .= "=" . $sValue;
          }
        }
      }
      
      $url .= $sOptions;
      
      $session = curl_init($url); // Open the Curl session
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2017-12-04
        • 2013-07-31
        • 2014-09-27
        • 2022-07-30
        • 2019-11-09
        • 2011-06-27
        • 2018-02-10
        • 2020-02-23
        相关资源
        最近更新 更多