# The ugly solution that worked: Why we shipped iframes in 2026 source: https://developer.mastercard.com/blog/the-ugly-solution-that-worked/index.md Sandboxed iframes are a punchline. They're also the cleanest way we found to facilitate a customer's brand on a login screen without their JavaScript sitting next to a user's banking password. Here's what that cost us, and why we would make the same call again. ### What is Data Connect? {#what-is-data-connect} [Mastercard Data Connect](https://www.mastercard.com/global/en/business/open-finance/solutions/data/data-connect.html) is part of [Mastercard Open Finance](https://www.mastercard.com/ie/en/business/open-finance.html). It lets people connect their bank accounts to an application and give permission to access their financial data. If you're more familiar with the term [open banking](https://www.mastercard.com/us/en/news-and-trends/Insights/2026/open-banking-to-open-finance-the-evolution-of-financial-data.html), Data Connect covers the same ground. Open finance is how open banking has evolved. It comes in three forms: | Path | Ownership | Control | Trade-off | |-------------------------|--------------------------------------|---------|----------------------------| | Data Connect Full | Mastercard hosts | Low | Fastest to launch | | Data Connect Lite | Shared surface | Medium | Some screens are yours | | Data Connect Components | You host most of the user experience | High | You shape the user journey | ![Connect options](https://static.developer.mastercard.com/content/blog/the-ugly-solution-that-worked/img/connect_options.png) This article is about the third option and the problem it solves for developers building bank linking into their own apps, whether that's for a fintech, lender or any product that needs permissioned bank data. When a financial institution supports OAuth, the user authenticates on the bank's own site, and no credentials come near your page. Legacy connections are different: someone still needs to render the bank's login form and collect the user's username and password. ### What is Data Connect Components? {#what-is-data-connect-components} [Data Connect Components](https://developer.mastercard.com/open-finance-us/documentation/connect/components/) is what gives your users an integrated bank-linking experience inside your application. Sending users to our screens mid-flow is disorienting, and it costs conversions. The bank-linking step has to feel native to the product, so developers needed to own the screens. But the most sensitive part of those screens, credential entry, had to stay where their code couldn't reach. The hard part is doing both at once. That's what this article covers. #### Here's the flow: {#heres-the-flow} Your backend asks our REST API for the institution's login form and gets back a list of the fields it needs. Your frontend passes that list to our web SDK, which renders each field as a web component, such as ``. Each component is a sandboxed iframe served by Mastercard. It sits on your page and takes your styling, but it's a separate window you can't read into. The user types their credentials into those iframes. When they're done, your own submit button calls the SDK's `submit()` method. The SDK tells the iframes to submit, and the credentials go straight to Mastercard. **Here's what the stack looks like, in order of trust:** ![Connect order of trust](https://static.developer.mastercard.com/content/blog/the-ugly-solution-that-worked/img/open-finance-connect-order-of-trust.png) ### Why use iframes instead of a standard form? {#why-use-iframes-instead-of-a-standard-form} Because every open finance integration balances three forces at once: how much friction the user will tolerate before abandoning the flow, how much risk the company is prepared to own when something goes wrong, and the regulatory and security guardrails, which you don't get to move. In practice, every one of these becomes a line of code someone must write. A standard form on the page would have been easiest for developers. But a standard form lives in your DOM, where it can be read by your JavaScript, plus every analytics script, tag manager and third-party library you load. That puts a user's banking password inside code neither of us fully controls. So we split the page into two zones. The customer zone is your app, your CSS, your consent copy and your lifecycle handling. The Mastercard zone is where credentials are entered and submitted. The line between them is the trust boundary. A sandboxed iframe gives credential entry its own origin, and the browser's same-origin policy stops the surrounding page reaching into it. You can style the field, place it anywhere and listen for its events, but you can't read what's typed into it. That's the boundary we needed, and it's why every credential field is an iframe. ![Connect zones](https://static.developer.mastercard.com/content/blog/the-ugly-solution-that-worked/img/open-finance-connect-zones.png) ### Why not use one large iframe? {#why-not-use-one-large-iframe} Because bank login forms don't have a fixed shape, and one frame around the whole form couldn't cope with that. Our first plan was one generic iframe that held the whole login form and that anyone could drop in. That model works well for card payments, where every form has the same fields: card number, expiration date and security code. Bank login forms don't work that way. One bank asks for a username and password. Another wants a user ID, a code and a password. Some add a security image or several MFA steps in a row. Across thousands of institutions, there's no standard shape. So each field became its own component in its own sandboxed iframe. That solved the layout issue, but it created the hardest problem in the build: getting those separate frames to communicate. ### How do sandboxed iframes communicate? {#how-do-sandboxed-iframes-communicate} Directly, as siblings, with each frame broadcasting its state to the others. That wasn't easy, because isolation was the point. Two sealed frames side by side have no natural way to tell each other what's happening. But the username frame needed to know the password frame existed, and both needed to know when the whole form was ready to submit. So we changed the relationship instead of the layout. The frames didn't communicate through a parent. They talked directly to each other, so credentials stayed sealed off from the page, but the fields could still act like a single form: aware of each other, ready together, submitted together. ### The design our customers turned down {#the-design-our-customers-turned-down} Iframes weren't our first answer. Our first design avoided embedding anything at all. The browser would turn the user's credentials into an opaque token and hand that to your app, so nothing sensitive ever sat on your frontend. From a security standpoint, it was hard to beat. The trade-off was in the request path. The app would pass a token to its backend, the backend would swap it with ours for the data it needed, and only then could the original call go ahead. That's an extra round trip on every request. Before writing any code, we showed the design to a few friendly customers. Their answer was clear: at the volumes they were planning, they'd never be able to accept the added latency. That conversation took a few hours. Finding out the same thing after launch would have cost months, along with the trust of the teams who built it. Getting a design in front of the people who'll integrate it, before you build it, is the cheapest test you'll ever run. It also changed the question we were asking. We couldn't just pick the most secure option anymore. We needed something that kept credentials out of their code and didn't add a round trip to every call. That sent us back to the browser itself, and to sandboxed iframes. ### The engineering trade-off: when clean became too fragile {#the-engineering-trade-off-when-clean-became-too-fragile} Our first version was stateless: the frames passed messages to each other, and nothing was saved in the browser. It was the cleanest and most elegant design, and we wanted it to work. It didn't hold up. We couldn't reliably tell when a login page had finished loading, and browsers didn't always load the frames in the same order or at the same pace. In testing, roughly one time in 1,000, the communication between frames failed and they never became aware of each other. The user would type their username and password, and the form would never report as ready. One in 1,000 is fine in a demo but not in production. At real volume, that would have been a steady stream of users entering their bank credentials and getting nothing back. So we made it stateful. Each frame now records that it's ready in browser local storage, so a frame that loads late can check what it missed instead of relying on catching a message at the right moment. The only thing stored is a flag saying each frame is ready. Nothing the user types is ever saved. That wasn't an easy call. We had specifically wanted to keep anything from persisting in the browser. We reviewed it against our security model and concluded the form would never work reliably without some shared state. ### The honest version {#the-honest-version} The clean solution was too fragile to ship. We aim for clean engineering principles and flexible abstractions, but sometimes the real world supplies more variables than the clean version can absorb. We shipped the slightly less elegant one that works, and we would make the same call again. ### Build on this {#build-on-this} * [Data Connect Components documentation](https://developer.mastercard.com/open-finance-us/documentation/connect/components/) * [Components flows and sequence diagrams](https://developer.mastercard.com/open-finance-us/documentation/connect/components/flows/) * [Data Connect Fix: reconnection experience](https://developer.mastercard.com/open-finance-us/documentation/experience-design-guide/connect-enhancements-and-features/recall-experience-connect-fix/) * [Data Connect Full and Lite](https://developer.mastercard.com/open-banking-us/documentation/connect/) * [Mastercard Open Finance US documentation](https://developer.mastercard.com/open-finance-us/documentation) * [Create a developer account and start testing in the sandbox](https://developer.mastercard.com/account/sign-up) *** ** * ** *** *This article is provided for informational and educational purposes only. Examples, architecture illustrations and workflows are illustrative and may vary by implementation, configuration and institution. Open Finance solutions in the United States are provided by Finicity, a Mastercard company.*