由于缺少策略文件权限而被拒绝

时间:2010-01-07 06:51:04

标签: actionscript-3 flash yahoo flash-cs4

我无法获取我的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中打开它。

4 个答案:

答案 0 :(得分:2)

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

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

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

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

答案 1 :(得分:0)

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

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

同时检查您的错误匹配http://www。使用http://因为flash将它们视为不同的域

您还在计算机上本地运行代码。它可能是您的本地安全设置

答案 2 :(得分:0)

一个简单的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
?>

答案 3 :(得分:0)

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

$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
相关问题