Skip to content
Expert Guide Series

How can you future proof your mobile apps API security?

A mobile app's API is the surface area where trust either holds or breaks. Every request the app makes, every piece of data it sends and receives, every action a user takes that touches a remote system passes through that layer. Get it wrong and you are not just looking at a data breach. You are looking at user confidence eroding, regulatory exposure mounting, and a product that becomes harder to defend with every new feature you add.

Good API security is a structural decision made early, one that shapes every layer of the product.

The challenge is that API security decisions made early in a product's life tend to compound. A shortcut taken during an MVP build becomes a structural assumption that every subsequent sprint is built on top of. We see this on almost every audit we run, where the security model was designed for the product as it was, and the product has since become something quite different.

This article works through the full picture: what API security actually means for mobile products, where the most common vulnerabilities sit, and how to build a security model that holds as your product grows. We draw on real decisions we have made across products, including a performance coaching survey app where we had no traditional API at all, a fitness social app where location data became a safety issue, and a travel product built for places with barely any signal. The principles are consistent even when the architecture is not.

What API security actually means for mobile apps

API security is often framed as a backend concern, something for server-side engineers to sort out while product teams get on with building features. That framing is wrong in a specific way: the decisions that shape how secure an API is are frequently made on the product side, long before a single security rule is written.

What data does the app request and when? Who is allowed to read what? How does the app authenticate the person making the request? These are product questions, and the answers determine the security posture of the whole system. A poorly scoped permission model is a design problem that code then implements faithfully.

For mobile apps specifically, the attack surface is wider than it is for a web application. The app binary is distributed to millions of devices, any of which can be inspected, modified, or used to intercept traffic. The API keys or tokens needed to communicate with a backend can sometimes be extracted from a compiled app. The network connection between the app and the server passes through infrastructure the product team does not control.

This means that API security for a mobile product encompasses what the server will accept, from whom, under what conditions, and what it will refuse regardless of how the request arrives. NowSecure found that 85% of analysed mobile apps contain security flaws. The gap between "the app works" and "the app is secure" is wide, and closing it requires thinking at the product level, not just the code level.

The most common API vulnerabilities in mobile products

The vulnerabilities that show up most often are predictable, and they are predictable because they follow from understandable pressures: moving fast, prioritising features, treating security as something to revisit later.

Broken object-level authorisation is the most common. This is where an API endpoint accepts a user's request for a specific record, say a booking or a profile, without checking whether that user actually owns it. If the record identifier is predictable, an attacker can iterate through IDs and read or modify records that belong to other users. The fix is straightforward, but it requires thinking about every endpoint in terms of ownership, not just access.

Exposed credentials are nearly as common. According to Serverion, 61% of organisations have accidentally exposed secrets such as API keys in public repositories. Keys hardcoded into a mobile app binary, committed to version control, or left in build scripts are live vulnerabilities the moment the code is visible.

Insufficient rate limiting is the third pattern. Without controls on how many requests a client can make in a given window, an API is open to credential stuffing, data harvesting, and denial of service. The API itself may be perfectly well-designed, and the vulnerability is still there.

Design built to grow your product

We give your app the strategic and design foundations it needs to launch well and keep growing. Research, UX/UI design and technical specs ready for your development team.

See how we work Get started

No commitment

Authentication and authorisation: getting the fundamentals right

Authentication answers "who is this?" and authorisation answers "what are they allowed to do?" They are different questions, and conflating them is where a lot of security models go wrong. An app that authenticates a user correctly but then grants them blanket access to all data associated with their account has answered the first question and ignored the second.

Authentication tells you who is asking. Authorisation tells you what they are allowed to receive.

For mobile apps, the authentication layer needs to handle several things reliably: issuing tokens that expire, refreshing them without requiring the user to log in again, and revoking them when a session needs to end. Short-lived access tokens paired with longer-lived refresh tokens are the standard pattern, and it works because a compromised access token has a limited window of usefulness.

Authorisation is where the granularity matters. Role-based access control assigns permissions by role, and it is a reasonable starting point, but most mobile products also need object-level rules. A user should be able to read their own records and only their own records, regardless of what role they hold. Building this into the data access layer, rather than relying on the application to filter correctly every time, is the more defensible approach.

Never rely on client-side checks to enforce authorisation. The server must validate every request independently, regardless of what the app presents to the user.

The Verizon 2024 Data Breach Investigations Report found that 76% of data breaches involved compromised credentials. The most robust authentication architecture in the world does not help if users reuse weak passwords. Supporting strong authentication options, including passkeys and biometric authentication where the platform allows, reduces the dependency on credentials that can be stolen.

How to secure an app without a traditional API layer

The assumption that every mobile app communicates with a purpose-built API is wrong. Some products, particularly MVPs and early-stage builds, connect directly to a backend-as-a-service platform such as Firebase. There is no intermediary server processing and validating requests. The app talks directly to the database, which means the database has to enforce every security rule itself.

We built this kind of architecture on a performance coaching survey app. The decision to skip a traditional API was deliberate: for an MVP, adding a dedicated API layer would have doubled the build scope and delayed the proof of concept. Firebase's real-time database handled the backend, and the security model had to compensate for the absence of a controlled intermediary.

The challenge is that without an API layer, there is no central point where you can validate a request before it reaches the data. Every rule has to be written at the database level, and those rules have to be airtight, because there is no second line of defence. We had to scrutinise every security rule very carefully to ensure that neither the app nor the web response page could be exploited.

This is a real trade-off, not a flaw. For a well-scoped MVP with a clear data model and limited user types, direct database access with tight security rules is entirely defensible. The risk comes when a product built this way grows, and the data model becomes more complex than the rules can cleanly handle. The decision to skip a traditional API should be revisited at each stage of growth.

Locking down database rules when there is no API intermediary

When the database is the boundary, the rules written into it carry the full weight of the security model. Firebase's security rules, and their equivalents in other backend-as-a-service platforms, allow you to specify who can read from and write to each collection or document. The rules can reference the authenticated user's ID, values inside the document, and conditions across multiple fields.

On the performance coaching survey app, we structured access around the specific survey record rather than a broad user permission. Each survey created by a presenter generated a record in Firebase. Audience members accessed their own unique response record via keys embedded in the QR code URL. This meant a respondent could read and write only to the record their key unlocked, and could not access any other participant's responses or any other survey.

Write access and one-submission controls

Preventing duplicate responses required an additional layer. We used a cookie and device fingerprinting to restrict write access to the responses collection to one submission per device per survey. This meant a respondent could not submit twice, even if they tried to access the survey URL a second time from the same device.

Time-limiting the data surface

We also used iOS's built-in libraries to generate QR codes entirely within the presenter's native app, so the codes were never stored externally. Once the presenter marked a survey as finished, no further responses could be recorded. The data surface was open only for as long as the session was live, which meant the survey was not a permanent vulnerability sitting in the database waiting to be found.

Designing data access so users can only reach what is theirs

The principle behind this is sometimes called least-privilege access: every user, every role, and every process gets access to exactly what it needs and nothing more. In practice it means designing the data model and the access rules together, rather than building the data model first and bolting access controls on afterwards.

On the performance coaching survey app, the access model was baked into the data structure itself. The unique key in the QR code was the access credential for that specific survey. A respondent who somehow obtained a different survey's URL would find their key granted no access to it. The authorisation logic was structural, not just a rule that checked a value.

This approach scales well because it does not require a growing list of rules that have to be maintained alongside a growing data model. The access follows the data structure, and changing the structure automatically changes what is accessible. It also makes the access model easier to audit: you can read the data structure and understand who can reach what without tracing through layers of conditional logic.

Design your data structure with access in mind from the start. If you cannot describe in one sentence who can read a given record and why, the access model needs more thought before the code is written.

Where user-generated content is involved, the same principle applies. A user's messages, uploads, or records should be tied to their identity at the data level, not just filtered at the application level. If a filter fails or is bypassed, object-level ownership in the data model is the last line of defence.

How privacy-sensitive features expose API security gaps

Some features carry a higher security burden simply because of what data they handle. Location, health information, private messages, financial records, and identity documents all demand more careful thinking about what is stored, who can see it, and what happens if the data is accessed without authorisation.

We worked on a fitness social app that was originally designed to show users' real-time locations on a map, so people could find each other and meet up for shared workouts. Research revealed that a high proportion of users were female, and precise location sharing became a significant safety concern. The team fundamentally redesigned the feature: rather than showing an exact pin, the app displayed a randomised location offset so users could see only the vague area where a potential workout partner was located.

This change did not remove the feature's core value. A user could still see that someone was nearby and judge whether a meetup was feasible. But the precise location was protected until a user actively chose to share it, after reviewing the other person's profile and exchanging messages. The opt-in reveal preserved personal safety while keeping the social mechanics intact.

The security gap that real-time location sharing creates extends to what happens to that data if a third party intercepts a request, or if a user's account is compromised. Randomising the stored location means that even a full data breach does not expose exact addresses. The security design and the privacy design are the same decision.

Offline-first architecture and the security risks of data queuing

When an app needs to work in places with unreliable or absent connectivity, the architecture has to account for what happens to user actions that cannot be sent immediately. Those actions have to be queued somewhere, held until the connection is restored, and then replayed against the live system. Each of those stages introduces a security consideration.

We rethought the architecture of a travel product aimed at younger backpackers visiting off-grid locations around four questions: what information could be stored offline, what had to remain online, how to queue offline actions and replay them once reconnected, and how to minimise the data sent between the app and the server to make the most of any available bandwidth.

What sits in the queue

The data queued on-device while offline is a target if a device is lost or compromised. Actions queued for later replay should not contain sensitive credentials or unencrypted personal data. Where possible, queue the instruction rather than the payload: "submit this form" rather than "submit this form containing these details, " with the details fetched securely at the point of replay.

Replaying actions safely

When queued actions replay against a live system, the server needs to validate them as though they were arriving in real time. An action queued offline and replayed after a session token has expired should fail gracefully, not silently succeed because the client-side queue manager has not checked token validity. The server is the authority on whether an action is still valid, not the queue.

How the way you ask for data affects whether users trust you with it

Security and trust are not the same thing, but they reinforce each other. A product that is technically secure but feels invasive will push users toward behaviours that weaken its security: sharing accounts, entering inaccurate data, or abandoning the product entirely. The way an app requests permissions and data shapes whether users engage honestly with it.

Asking permission rather than demanding access changes how users relate to the request. Framing a data request as "can we connect your location to help you find nearby partners?" lands differently than a permission dialogue that appears without context. The information transferred is the same. The user's sense of control is not. People who feel they have made an active choice about what they share are more likely to engage fully and honestly with the product.

Deloitte found that 79% of consumers are concerned about how brands handle their data. That concern is not irrational. An app that asks for permissions it does not obviously need, or that requests access at a moment that feels unrelated to any value the user is getting, will be refused or abandoned. The 62% of Android apps that request one or more dangerous permissions, as found by NowSecure, are asking the right question about what the system allows and the wrong question about what the user will accept.

Request permissions at the point of use, not on first launch. A location permission requested when a user taps "find someone nearby" is contextually obvious. The same permission requested on the splash screen is a red flag.

Token management, session handling, and expiry

A token is a trust artefact. It tells the server that whoever is presenting it has already been verified, and that their request should be honoured. If a token is stolen, that trust is transferred to the attacker. Managing tokens well means limiting how long they remain valid, storing them carefully, and having a clear mechanism for ending sessions.

Access tokens should be short-lived, typically measured in minutes or hours rather than days. A refresh token, stored more securely, allows the app to obtain a new access token without requiring the user to authenticate again. When a user logs out, both tokens should be invalidated server-side, not just deleted from the device. Client-side deletion alone does not prevent a previously captured token from being replayed.

Secure storage on device

On iOS, tokens should be stored in the Keychain rather than in UserDefaults or local storage. On Android, the equivalent is the Android Keystore system. Both provide hardware-backed encryption for sensitive values. Storing a token in a location accessible to any app or readable without authentication undermines everything the token is trying to protect.

Session expiry and graceful handling

Session expiry should be handled gracefully so that users understand what has happened and can re-authenticate without losing their work. An abrupt logout with no explanation, or a confusing error state when a token expires mid-session, creates friction that users associate with the product being unreliable. The security event should be invisible in its mechanism and clear in its communication.

Rate limiting, abuse prevention, and anomalous behaviour detection

An API that will accept an unlimited number of requests from any source is an API waiting to be abused. Rate limiting sets a ceiling on how many requests a client can make in a given time window, and it is one of the most straightforward controls available. Without it, the same endpoint that serves legitimate users can be used to enumerate records, test stolen credentials, or generate enough traffic to degrade the service for everyone.

Rate limiting is the simplest control that separates a defensible API from one that invites systematic abuse.

Adaptive rate limiting goes further than a fixed ceiling. Rather than blocking a client after a set number of requests regardless of context, adaptive systems analyse the behaviour of requests and apply tighter limits to patterns that look anomalous: many failed authentication attempts, requests arriving faster than any human user could generate them, or requests that follow predictable enumeration patterns. Shopify reduced credential stuffing attacks by 82% by implementing adaptive rate limiting that analysed request behaviours, according to Serverion.

Anomalous behaviour detection works alongside rate limiting. A user who logs in from London and then makes an authenticated request from a different continent thirty seconds later is doing something a human cannot do. A session that generates ten times the usual number of requests in a short window is worth examining. These signals do not confirm a breach, but they are worth acting on, either by triggering additional authentication or by flagging the session for review.

In-product safety controls as a layer of security

Security controls are not only technical. Some of the most effective ones are built into the product experience itself: reporting mechanisms, content moderation queues, block and mute features, and the design of how users interact with each other. These controls matter most on products where user-generated content or user-to-user interaction is central to the value.

On an anonymous messaging app, we added in-product reporting features that allowed users to escalate concerns about inappropriate or bullying messages to the client's admin team. This was part of a broader set of safety measures introduced as we worked deeper into the product and examined the security and safety concerns that anonymous messaging inherently creates. Anonymity is a design choice that has a direct security implication: it removes the social accountability that moderates behaviour in identified spaces.

The fitness social app's randomised location offset is another example of a safety control built into the product rather than bolted onto the backend. The feature did not work by detecting bad actors after the fact. It worked by structuring the data in a way that prevented precise location exposure from the start. The control was architectural, and it held regardless of what any individual user or attacker tried to do.

In-product safety controls also give users agency. A reporting button does not just create a moderation queue; it signals to the user that the product takes safety seriously and that there is somewhere to go when something goes wrong. That signal matters for trust, and trust affects engagement.

How to test and audit your API security before problems emerge

Security testing is most useful when it happens before a product ships, and most often happens after a problem has already surfaced. The gap between those two moments is where vulnerabilities live undetected, and closing it requires making security review a routine part of the build process rather than a one-off exercise.

A basic API security audit covers a predictable set of questions. Can an authenticated user access records that belong to another user by modifying a request parameter? Can an unauthenticated request reach any endpoint that should require authentication? Do error responses leak information about the data model or the infrastructure? Is rate limiting applied consistently across all endpoints, including less-used ones? These questions do not require specialist tooling to answer. They require someone to ask them deliberately.

Automated scanning and penetration testing

Automated scanning tools can identify a class of common vulnerabilities quickly and consistently. They work best as a baseline check, not as a substitute for manual review. A scanner can find an unprotected endpoint; it is less reliable at finding a logical flaw in an access control model that works exactly as written but produces the wrong outcome. Penetration testing by someone who thinks like an attacker catches the second type of problem, and it is worth running before each major release rather than only at launch.

Reviewing third-party libraries

Third-party libraries introduce vulnerabilities the product team did not write and may not be monitoring. Only 52% of developer respondents said they always consider security when evaluating a new third-party library, according to Veracode. A dependency audit run as part of each release cycle, using a tool that flags known CVEs in the libraries a project depends on, is a straightforward control that teams routinely skip.

Keeping security defensible as your product scales

A security model built for ten users behaves differently at ten thousand. The data model grows more complex, new user types are added, integrations with third-party services multiply, and the original access rules, written when the product was simple, start to strain. Growth will stress the security model; the question is whether the team will notice before something breaks.

The decision to skip a traditional API layer, which we made deliberately on the performance coaching survey app for a well-scoped MVP, is a decision worth revisiting as the product evolves. An architecture that is appropriate for a proof of concept may not be appropriate once the user base grows and the data model becomes more complex. The MVP decision should be documented as a trade-off, with a clear trigger for when to revisit it, rather than becoming a permanent assumption.

Modular security design helps. If the access control logic lives in one place rather than being distributed across dozens of endpoints or database rules, it is easier to update when the product changes. When new features are added, the question "what does this feature need access to, and who should be able to reach it?" should be answered before the feature is built, because the answer is shaped by app architecture design decisions made well before a later audit can catch them.

When a new feature touches a data type that existing users did not previously have access to, treat it as a new access control decision, not an extension of an existing one. The cost of designing it carefully upfront is small. The cost of unpicking a wrong assumption later is not.

Logging and monitoring become more important as scale increases. At low volume, anomalous behaviour is visible to anyone paying attention. At high volume, it disappears into the noise without tooling to surface it. Access logs, error rates, and authentication failures should be monitored continuously, and alerts should be configured so that the team does not have to be watching a dashboard to notice a problem.

Conclusion

API security in a mobile product is a product discipline as much as an engineering one. The decisions that matter most, what data is collected, who can access it, when permissions are requested, how sessions are handled, whether an API layer exists at all, are made by product teams and architects long before a security rule is written.

The work we have described across the performance coaching survey app, the fitness social product, the anonymous messaging app, and the off-grid travel product shares a common thread. In each case, the security model was shaped by understanding the specific risks that product created for its specific users. Generic security advice would not have caught the location safety issue on the fitness app. A standard API architecture would not have been appropriate for the MVP survey tool. The right answer in each case came from thinking carefully about the product, not from applying a template.

The goal is a security model you can explain clearly, test reliably, and update without dismantling. That requires treating security as a design constraint from the start, not a remediation task at the end. It requires asking who can reach what, and why, at every stage of the product's growth. And it requires being willing to revisit early decisions when the product has grown beyond what those decisions were designed to handle.

If you are building a mobile product and want to think through the security model before it becomes a problem, let's talk about your API security.

Frequently Asked Questions

What does API security actually mean for a mobile app?

API security covers everything the server will accept, from whom, and under what conditions, including what it will refuse regardless of how a request arrives. For mobile apps, this is wider than for web applications because the app binary is distributed to many devices and can be inspected or modified. It is also a product-level concern, not just a backend one, since decisions about data, permissions, and authentication shape the security posture of the whole system.

Why are API security decisions made early in a project so important?

Shortcuts taken during an MVP build tend to become structural assumptions that every subsequent sprint is built on top of. Over time, the security model ends up designed for the product as it was, not the product as it has become. This makes the app progressively harder to defend with every new feature added.

What is broken object-level authorisation and why is it so common?

Broken object-level authorisation is where an API endpoint accepts a request for a specific record without checking whether the requesting user actually owns it. If the record identifier is predictable, an attacker can iterate through IDs and access data belonging to other users. It appears frequently because it follows from familiar development pressures, such as moving fast and treating security as something to revisit later.

How can API keys or tokens be exposed in a mobile app?

Because a mobile app binary is distributed to millions of devices, it can be inspected or decompiled by anyone who has it. API keys or tokens embedded in a compiled app can sometimes be extracted through this process. The network connection between the app and the server also passes through infrastructure the product team does not control, creating further opportunities for interception.

How widespread are security flaws in mobile apps?

Research by NowSecure found that 85% of analysed mobile apps contain security flaws. The gap between an app that works and an app that is genuinely secure is considerable. Closing that gap requires thinking at the product level, not just at the level of individual code decisions.

Can a mobile app have meaningful API security without a traditional API?

Yes. The article references a performance coaching survey app that had no traditional API at all, yet security principles still applied to how data was handled and transmitted. The underlying principles of API security remain consistent even when the architecture differs significantly from the standard model.

What kinds of product decisions have the biggest impact on API security?

Decisions about what data the app requests, when it requests it, and who is permitted to read what are all product questions with direct security consequences. A poorly scoped permission model is a design problem that code then implements faithfully. Treating these as security questions from the outset, rather than feature questions, makes the resulting system much easier to defend.

How does a mobile app's attack surface differ from that of a web application?

A mobile app's attack surface is wider because the binary is distributed directly to devices that can be inspected, modified, or used to intercept traffic. Web applications are not distributed in the same way, so the server-side code is not as directly exposed to end users. This means mobile API security must account for threats that web-focused security models do not always address.