【问题标题】:Intuit connectToIntuit button is not passing control back to parent pageIntuit connectToIntuit 按钮未将控制权传递回父页面
【发布时间】:2013-05-02 08:06:10
【问题描述】:

我们已经按照以下链接实现了 Intuit 连接按钮功能:

https://ipp.developer.intuit.com/0010_Intuit_Partner_Platform/0025_Intuit_Anywhere/0020_Connect/0010_From_Within_Your_App/Add_the_Connect_Button

它一直到最后都很好用,但不是将控制权返回给父页面,而是在弹出窗口中打开应用程序。我真的不知道我在这里错过了什么。以下是我们针对此功能的单元测试页面:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ipp="">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<meta http-equiv="Cache-control" content="no-cache"/>
<title>Intuit Test Page</title>
<script src="https://js.appcenter.intuit.com/Content/IA/intuit.ipp.anywhere.js" type="text/javascript">
    </script>
<script type="text/javascript">
    intuit.ipp.anywhere.setup({
      menuProxy: 'myserver.com/intuit/proxy',
      grantUrl: 'myserver.com/intuit/connect'
    });
    </script></head><body>
    <ipp:connectToIntuit></ipp:connectToIntuit>
    </body>
    </html> 

除服务器名称外,代码相同。如果您能就此提供一些意见,我真的很感激?

【问题讨论】:

    标签: javascript quickbooks intuit-partner-platform intuit


    【解决方案1】:

    Intuit Anywhere 的 OAuth 流程始终在弹出窗口中打开。它专门为此而设计。

    当他们单击按钮时,弹出窗口将打开,他们将完成 OAuth 连接过程,并最终转发回您的应用程序。然后,您的应用程序应关闭弹出窗口,并刷新应用程序的父页面(以便蓝点菜单显示在页面上以表明它们已连接)。

    【讨论】:

    • 是的,你负责编写关闭弹窗和刷新父窗口的逻辑。
    • 如何添加刷新父窗口的逻辑?
    • 简单的 Javascript。已经有大量关于此的 StackOverflow 帖子:stackoverflow.com/questions/2301278/…
    • 谢谢你!所以我的问题是,当我使用开发者控制台查看页面时,window.opener = {}。我认为这与跨站点脚本有关。一旦 intuit 页面重定向回我的域,window.opener 就会有一个值。
    【解决方案2】:

    我找到了一个非常简单的解决方案。

    在您的控制器中,您可以在验证操作中指定:

    render :text => '<script type="text/javascript">window.opener.location.reload(true);window.close();</script>'
    

    这将导致弹出窗口关闭,调用窗口自动刷新。

    【讨论】:

    • 在指定的 Rails 视图文件中执行此操作。还是很有帮助的!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-06-08
    相关资源
    最近更新 更多