1

So Intuit charges for each active connections to QuickBooks. Therefore, I want to restrict the QuickBooks functionality in my application to premium users only.

Ideally when any user clicks the "Connect to QuickBooks" button and my RequestOAuthToken http handler is called, I want to check if the user is allowed to use QuickBooks. If that is the case, then the normal OAuth flow continue. If the user is NOT allowed, then I want to redirect the user to the upgrade page of my app.

Given that the "Connect to QuickBooks" button opens a new window (at least on desktop, I haven't tried on phone/tablets), the window should get closed, and the main window (my app) should redirect the user to the right page. And actually this is exactly what happens if the normal OAuth flow completes.

Now, I have tried a few different approaches but I couldn't get it working.

1) In my RequestOAuthToken, return a HTTP redirect to the plan page

2) In my RequestOAuthToken, return an html page with javascript logic to redirect to page

3) In my RequestOAuthToken, return HTTP redirect to a page with javascript logic to redirect to page

4) I haven't tried that one but could I somehow intercept the javascript click handler on the Intuit button. I'm not sure if that is an accepted practice.

Here is the piece a javascript I grabbed from the .Net sample:

try
{
    var parentlocation = window.parent.opener.location.hostname;
    var currentlocation = window.location.hostname;
    if (parentlocation != currentlocation)
    {
        window.location = plansUrl;
    }
    else
    {
        window.opener.location.href = window.opener.location.href;
        window.close();
    }
}
catch (e)
{
    window.location = plansUrl;
}

Help me out please.

4

2 回答 2

4

I don't think you'll be able to do exactly what you're asking, but you can probably come close by taking a different approach.

Rather than trying to redirect them after they click the button, why not try to redirect them before they click it? e.g. when they try to get to the page that has the "Connect to QuickBooks" button it, check if they are a premium user there, and redirect them if they are not.

I don't think you'll be able to redirect them after they click the button because once they click that button, they get kicked over to Intuit's website and it's beyond your control at that point.

于 2013-04-24T02:28:07.600 回答
2

Clement, Keith has provided the answer we would want you to pursue. You may not alter the behavior of the Connect To QuickBooks button. It must be used as described in our documentation. Providing a link to a page that shows the Connect To QuickBooks buttons for your premium users and an upgrade message to non-premium users is the way to go.

I highly recommend that you visit http://docs.developer.intuit.com/0025_Intuit_Anywhere/0010_Getting_Started/0040_Publishing_Your_App and review all of the documentation there. If you develop with our guidelines and requirements in mind it will speed up the review process.

Tony Purmal Developer Relations Engineer Intuit Partner Platform

于 2013-04-24T20:21:51.567 回答