【问题标题】:Getting Rally API key to work outside of rally App让 Rally API 密钥在 Rally App 之外工作
【发布时间】:2014-10-29 18:15:52
【问题描述】:

我已经看到了这个问题和回复,但它仍然对我们不起作用: Embedding Apps with API key

我们在使用 Rally API 时遇到问题。我们的目的是制作一个显示投资组合看板的独立页面(在 Rally 之外)。

我已附上测试页。它是使用 rally-app-builder 创建的。我们创建了一个 API 密钥。当我们尝试加载页面并传递 API 密钥时,我们会收到一个关于跨站点违规的 json 异常。文档说如果我们不传递密钥,我们会看到这个错误。但即使我们确实通过了它,错误仍然存​​在。

我们已经通过 apache 服务器进行了尝试,因此独立文件的问题不是我们的问题。有没有人有其他想法?

html页面如下。

<!DOCTYPE html>
<html>
<head>
    <title>helloworld</title>

    <script type="text/javascript" src="https://rally1.rallydev.com/apps/2.0rc3/sdk.js"></script>

    <script type="text/javascript">
        Rally.onReady(function () {
                Ext.define("CustomApp",{extend:"Rally.app.App",componentCls:"app",items:{html:'<a href="https://help.rallydev.com/apps/2.0rc3/doc/">App SDK 2.0rc3 Docs</a>'},launch:function(){this.add({xtype:"rallycardboard",types:["Portfolio Item/Feature"],attribute:"State",storeConfig:{context:{project:"/project/14292239482",projectScopeUp:!1,projectScopeDown:!0}},context:this.getContext(),readOnly:!0})}});

            Rally.launchApp('CustomApp', {
                name:"helloworld",
	            parentRepos:""
            });

        });
    </script>


    <style type="text/css">
        
    </style>
</head>
<body>
</body>
</html>

我们生成的 api 密钥是 alm-wsapi-read-only 类型。加载页面时,即使提供了 apikey 参数,我们也会收到 JSON x-site 错误。

我们想知道在 Rally 订阅方面是否有要更改的配置,或者文档中是否有错误或其他简单的问题。

【问题讨论】:

    标签: rally


    【解决方案1】:

    我提交了一个缺陷。当我使用 rally-app-builder 运行命令加载 App-debug.html 时,它一直有效:

    rab run
    

    并将 apiKey 作为查询参数附加到应用的 URL。使用 apiKey 可以正常加载:

    当我选择不同的服务器来加载嵌入式应用程序时,问题就开始了,例如:

    a)在另一个目录中启动一个简单的 http python 或节点服务器

    b)将 App-external.html 从部署文件夹复制到运行服务器的目录

    c)在这个目录下新建一个文件,App-embedded.html:

    <html>
      <header>
        <title>Embedded app test: revs</title>
      </header>
      <body>
        <iframe src="http://localhost:9000/App-external.html?apiKey=_Ib4u6d7"></iframe>
      </body>
    </html>
    

    d)加载 App-embedded.html

    这些步骤会导致跨域错误。

    如果您检查 Chrome 的网络选项卡或 Safari 调试器,它会显示工件(分层要求或缺陷)请求失败。有趣的是,前面的订阅、用户和模式请求成功完成。 Safari 截图:

    【讨论】:

      【解决方案2】:

      事实证明,根本问题与 Rally 服务器上的 CORS 配置有关,与 App SDK 2.0rc3 无关。自 2014 年 11 月 24 日起,此问题应得到解决。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-09-07
        • 1970-01-01
        • 2012-09-21
        • 1970-01-01
        相关资源
        最近更新 更多