IAV flow on mobile device in UIWebView exits app and opens mobile safari


(Cody Mahan) #1

On my ionic app, the iav flow is working perfectly while testing in chrome. It goes through each of the iav steps and returns a funding source. When I run the app on my device (iphone, ios 9) the first page of the iav loads (with the list of banks) but when I tap on any bank or button, it exits the app and opens the link in mobile safari. Has anyone experienced this issue before?

dwolla.iav.start(resp.data.iavToken, {
            container: 'iavContainer',
            stylesheets: [
              'https://fonts.googleapis.com/css?family=Lato&subset=latin,latin-ext',
              'https://dl.dropboxusercontent.com/s/mykri3vc74yjtjp/dwolla.css'
            ],
            fallbackToMicrodeposits: true
          }, function (err, res) {
...

err is {code:“UnexpectedPage”, message: “IAV navigated to an unexpected page and was cancelled.”}


(Cody Mahan) #2

@stephen @DWOLLA do you think its possible to add something like this to dwolla.js to prevent my issue above?


(Stephen Ausman) #3

Hmm, I wonder if your app can be configured to prevent this from happening. It looks like Cordova has a stay-in-webview setting that may work?

https://www.sencha.com/forum/showthread.php?237275-IFrame-content-always-opening-browser-window-prevent-this


(Cody Mahan) #4

unfortunately adding that setting has no affect on this issue.

Does it help you to note that the flow seems to work correctly without leaving the webview if I can get it past the first bank selection screen?

To do this, I inspected the iframe dom and copied the contents of the href of the Wells Fargo <a> tag, then I manually updated the the iframe src with that href. It moved to the account input view and I was able to continue normally from there.


(Cody Mahan) #5

Alright, well I have come up with a solution that seems to work, although it seems a little silly that I have to go to this extent.

I moved the logic to start the iav flow out of my ionic (angular) app into its own html file and then loaded it up in the app using the in app browser plugin. Then I generate an iav token from an api call in the app and pass it to a function on the new page via executeScript. This launches iav and I am able to process the callback and retrieve the funding source.

3 things I have noticed that seem to be annoyances with dwolla.js with this approach:

  1. the iframe loads with css visibility: hidden sometimes. I am just overriding this with a global css on iframes so thats not a big deal.
  2. the flow attempts to abort sometimes with the UnexpectedPage error. I catch this error code and ignore it and am able to continue without any issues.
  3. It is sluggish, taking 6-7 seconds from calling iavstart to rendering anything on the page. This leaves me to display a loading indicator and guesstimate when to hide it. It is also slow when you select a bank, taking long enough to change screens that it seems like there is an error.

If the dwolla team has any input here, that would be great.


(Stephen Ausman) #6

Awesome!

Then I generate an iav token from an api call in the app and pass it to a function on the new page via executeScript

Before you move to production I would generate the iav token on your server instead of within the app.

As far as those 3 things go…

  1. visibility: hidden will be removed once the iframe finishes loading
  2. I pushed a fix that should help with this Friday evening, has it gone away?
  3. Hmm that is an abnormally long time. Does it consistently take this long?

(Cody Mahan) #7

oh sorry - I meant that I am making an api call to my server to generate the iav token from my app, then passing the token across to the script that fires up the iav flow.

I am not seeing the UnexpectedPage error as often now. Maybe not at all - I will have to keep testing to see. I guess the iframe staying hidden because of these errors. Sometimes it only takes 3-4 seconds to load.


(Cory Anderson) #8

(Cory Anderson) #9

(Cory Anderson) #10