Mosmoxmosmox

Mosmox journal

In focus — security.

A selection of publications grouped under the security tag.

Expo + Supabase for an MVP: A Backend in One Command and the RLS You Cannot Ship Without

Expo + Supabase for an MVP: A Backend in One Command and the RLS You Cannot Ship Without

On November 10, 2026 Expo added an EAS CLI command that connects Supabase to an Expo app in one step: it creates the project, installs the SDK and writes keys into every environment. For an MVP this means Postgres, authentication, file storage and realtime in a few minutes. But there is one thing you cannot ship such an app without: Row Level Security. Here is how the integration works and what to do before release.

The facts come from the Expo changelog.

What the command does

You need eas-cli 21.8.0 or newer and a project linked to Expo Services. The eas integrations:supabase:connect command:

  • opens the browser once to authorize Supabase, asks for an organization and region, and creates the project;
  • installs @supabase/supabase-js and expo-sqlite and adds the expo-sqlite config plugin;
  • writes EXPO_PUBLIC_SUPABASE_URL and EXPO_PUBLIC_SUPABASE_PUBLISHABLE_KEY to .env.local and to Expo environment variables for Production, Preview and Development.

Local development, builds and updates all read the same values. If you already have a Supabase project, connect it with --link. Rerunning is safe: the command reuses what it created and asks before replacing anything. In CI, after a one-time browser authorization, it runs without prompts using --non-interactive.

Who owns the project

The project is created in your own Supabase organization: the data and the bill are yours. Expo keeps an encrypted token so the CLI can act on your behalf; you can revoke it in Supabase or with eas integrations:supabase:disconnect. Expo generates a random database password, hands it to you and keeps no copy. If you later need psql or migrations, reset the password in the Supabase dashboard.

The key point: RLS

Both values the command writes are public: they are bundled into the app and anyone can extract them from a build. Expo states plainly that Row Level Security is what protects the data. Without RLS and policies, anyone with the publishable key can query your tables directly, bypassing the app.

What to do before the first release:

  • Enable RLS on every table the app reads or writes.
  • Write separate policies for select, insert, update and delete. The usual approach is access only to rows whose owner matches the current user's ID.
  • Test the policies with requests as another user and while signed out.
  • Never put Supabase secret keys with full access into the app: they belong only on the server or in edge functions.

A separate backend per environment

At first all three environments share one project. That is convenient for an MVP but risky: a test build writes to production data. Running eas integrations:supabase:connect --environment preview creates a separate project for Preview, so a preview build can never change production. We recommend doing this before the app gets its first real users.

Sessions and native modules

The client snippet in the docs stores the session in expo-sqlite, so users stay signed in between launches with no AsyncStorage and no custom adapter. Everything works in Expo Go. You need a development build once you pass options to the expo-sqlite plugin or add other native libraries.

Local development

The app reads .env.local, so switching to a local database is a two-line change. npx supabase init and npx supabase start bring up Postgres, auth and Studio on your machine without a Supabase account. Take the URL and key from supabase status, and create your tables in Studio at 127.0.0.1:54323, since the local database starts empty. Local work does not count against the two active projects on the Supabase Free plan.

MVP checklist for Expo + Supabase

  • eas-cli 21.8.0+, eas integrations:supabase:connect.
  • RLS enabled on all tables, policies tested as different users.
  • A separate Supabase project for Preview.
  • Database schema and policies kept as migrations in the repository, not only in the dashboard.
  • A local stack for development so experiments never touch cloud data.
  • Before release, check your Supabase plan and the Free plan limits.

Conclusion

The Expo and Supabase integration removes the manual backend and environment variable setup: from an empty project to the first database query takes minutes. It is a good start for an MVP. A fast start does not cancel security, though: a public key in the app is fine only when RLS and policies really restrict access. Set them up, together with a separate Preview environment, before real data arrives in the app.

OWASP MASVS in Practice: A Security Checklist for Your Mobile App

OWASP MASVS in Practice: A Security Checklist for Your Mobile App

When a client asks "is our app secure?", the honest answer is almost always "secure against what?". That is why at Mosmox we never start an audit with a random grab-bag of checks. We anchor it in OWASP MASVS, the industry standard for mobile app security requirements. It gives developers, testers, lawyers and the security teams of banks or insurers a shared vocabulary — and those teams increasingly make compliance a contractual condition.

This article covers how MASVS is structured since version 2, which control groups we actually check on every project, how to choose the right level of rigour, how much time to budget, and the mistakes we keep finding. We have covered general security mistakes in an earlier journal post; here the focus is a methodical, standard-based review.

MASVS, MASTG and MASWE: what each one is for

The OWASP Mobile Application Security (MAS) project consists of three linked documents:

  • MASVS (Mobile Application Security Verification Standard) — high-level requirements: what must be ensured, e.g. "the app securely stores sensitive data".
  • MASTG (Mobile Application Security Testing Guide) — the hands-on manual: how to verify it on Android and iOS, with tools, commands and code samples.
  • MASWE (Mobile Application Security Weakness Enumeration) — a catalogue of concrete weaknesses that links abstract requirements to tests.

Version 2.0 (2023) simplified the standard dramatically: dozens of granular items were removed, and the old L1/L2/R levels are no longer part of the standard itself. MASVS now describes requirements, while testing profiles (L1, L2, R, P) live in MASTG. For a business, this means that a "MASVS L2" clause in an old tender document needs translating into current terminology — otherwise vendor and client will mean different things.

Eight control groups and what sits behind them

Current MASVS has eight groups. Here is how we explain them to the team and what we check first.

GroupCoversWhat we check first
MASVS-STORAGEOn-device data storageTokens only in Keychain / Android Keystore-backed storage; no personal data in logs, WebView caches or backups
MASVS-CRYPTOCryptographyNo home-grown algorithms, no hardcoded keys, modern modes (AES-GCM), proper random number generation
MASVS-AUTHAuthentication and authorizationPermissions enforced on the server, not the client; biometrics bound to a cryptographic key; proper session termination
MASVS-NETWORKNetwork communicationTLS only, no ATS or cleartext exceptions, a deliberate decision about certificate pinning
MASVS-PLATFORMInteraction with the OS and other appsExported activities, deep links, WebViews with JavaScript bridges, IPC, screenshot protection on sensitive screens
MASVS-CODECode quality and dependenciesInput validation, up-to-date SDKs, minimum OS version, a forced-update mechanism
MASVS-RESILIENCEResistance to reverse engineeringObfuscation, root/jailbreak and tamper detection, integrity checks via Play Integrity / App Attest
MASVS-PRIVACYPrivacyData minimisation, transparency, user control; consistency with the Privacy Manifest and Data safety form

The PRIVACY group arrived in version 2.1 (2024), which makes sense: Apple's Privacy Manifest requirements and Google Play's Data safety section turned privacy into something verifiable rather than aspirational.

Choosing a profile: L1, L2, R or P

The most expensive mistake is applying banking-grade requirements to a habit tracker, or the reverse. MASTG profiles let you scale the effort:

  • L1 — baseline security for any app. This is hygiene we treat as mandatory even for an MVP.
  • L2 — defence in depth for apps handling sensitive data: finance, health, government services, corporate access.
  • R — resilience against reverse engineering and client tampering. Needed when the value lives in the client itself: games with in-app economies, DRM content, anti-bot protection.
  • P — privacy; relevant to anyone processing personal data.

Our rule of thumb: L1 + P always; L2 if one user's data leaking means direct financial or medical harm to them; R if an attacker can profit from a modified client. R without L2 rarely makes sense — obfuscation will not save you if the server trusts the client.

Step by step: how we run an audit

Step 1. A one-page threat model

Before any testing we write down which data is valuable (tokens, payment data, medical records), who the attacker is (someone holding an unlocked phone, a malicious app on the same device, a public Wi-Fi attacker, a competitor decompiling the APK) and what the consequences would be. Without this, the report becomes a list of "findings" nobody knows how to prioritise.

Step 2. Static analysis

We decompile the build (jadx for Android, IPA analysis for iOS) and look for API keys, staging URLs, disabled certificate validation and debug flags. In parallel we run automated scanners such as MobSF — they surface the obvious quickly but produce plenty of false positives, so every finding is verified by hand.

Step 3. Dynamic analysis

We install the app on a rooted or jailbroken device, intercept traffic through a proxy and instrument it with Frida. We check what sits in the sandbox after login and after logout, what lands in the system log, and whether internal screens open via a deep link without authentication.

Step 4. Testing the backend from the client's side

Most critical findings in mobile audits are actually server-side: the API returns extra fields, lets you modify someone else's resource by swapping an ID (IDOR), or doesn't rate-limit OTP attempts. MASVS explicitly requires authorization to happen on the server, so we consider a mobile audit without API testing incomplete.

Step 5. Report and retest

Every finding gets a MASVS group and MASTG test reference, a severity rating and a concrete recommendation. A retest after fixes is mandatory: in our experience roughly one in five "fixes" addresses the symptom rather than the cause.

How long it takes

The estimates below are guidelines from our own practice for a mid-complexity app (20–40 screens, one platform). For two platforms budget roughly 1.6–1.8×, since part of the work (API, threat model) is shared.

ScopeDurationWhen it fits
Team self-review against an L1 checklist1–2 daysBefore every major release
External L1 + P audit3–5 daysBefore public launch or a funding round
L2 audit including the API7–12 daysFintech, healthtech, enterprise apps
L2 + R with protection-bypass testing10–20 daysPayment services, games with economies, DRM

An automated scanner in CI costs next to nothing and catches regressions, but it does not replace a manual audit: it cannot see broken authorization logic, which is exactly what hurts most.

The mistakes we find most often

  1. Secrets in the client. Third-party API keys that unlock paid services or other people's data. Anything shipped in the build should be treated as public — obfuscated or not.
  2. Tokens in insecure storage. SharedPreferences or UserDefaults instead of Keychain/Keystore; refresh tokens that never expire.
  3. Logs with personal data. Request bodies with phone numbers, addresses or tokens left over from debugging, ending up in system logs or a third-party analytics tool.
  4. Trusting the client. Price, discount, user role or subscription status sent from the app and never validated server-side.
  5. Open Android components. An activity with exported="true" that opens an internal screen without checking the session.
  6. Unrestricted WebViews. JavaScript enabled, a native bridge and arbitrary URL loading — the classic path to running someone else's code inside your app's context.
  7. Box-ticking pinning. Certificate pinning with no rotation plan: one day the app stops working for every user. Pinning makes sense at L2, but only with a backup key and a way to update the configuration.
  8. No forced update. When a vulnerability is found, old versions live on for years. MASVS-CODE explicitly calls for a mechanism that makes users update.

Making MASVS part of the process, not a one-off audit

A one-off audit is a snapshot of a single day. To keep security from decaying, we build MASVS into the normal development cycle:

  • Definition of Done. Tasks touching authentication, storage or networking get 3–5 relevant L1 items in the pull request checklist.
  • CI automation. Dependency scanning for known vulnerabilities, secret detection in the repository and static analysis of every release build.
  • Device attestation. For L2/R — the Play Integrity API on Android and App Attest on iOS, with the verdict checked on the server, not in the app.
  • Cadence. A full audit once a year or after significant architectural changes (a new payment provider, a new sign-in method).

An L1 checklist to start with

  • Tokens and keys are stored only in Keychain / Android Keystore.
  • The release build has no debug logs containing personal data or tokens.
  • Backups contain no sensitive data (allowBackup / backup rules configured on Android, file protection attributes on iOS).
  • All traffic is TLS; no unjustified ATS exceptions or cleartext traffic.
  • The build contains no secrets granting access to paid services or data.
  • Authorization and business rules (prices, roles, subscriptions) are enforced on the server.
  • Exported components and deep links cannot open protected screens without a session.
  • WebViews don't load arbitrary URLs and expose no unnecessary JavaScript bridges.
  • Dependencies are up to date with no known critical vulnerabilities.
  • A forced-update mechanism exists for the minimum supported version.
  • The Privacy Manifest and Data safety form match what the app actually collects.

If three or more of these items fail today, fix them before commissioning an in-depth audit: an external specialist will find the same things, just at a higher price.

Sources: OWASP MASVS; OWASP MASTG; OWASP MASWE; Android: Security guidelines; Apple Security documentation; Play Integrity API; Apple DeviceCheck / App Attest.

Secrets in Mobile Apps: Keychain, Android Keystore and What Never Belongs in the Build

Secrets in Mobile Apps: Keychain, Android Keystore and What Never Belongs in the Build

Every mobile build is a file you voluntarily hand out to millions of people. An IPA or APK can be unpacked, its strings extracted in a minute, and its traffic inspected through a proxy on your own device. So the core security rule is blunt: treat everything in the build as public. Obfuscation makes analysis harder, but it does not turn a key into a secret.

At the same time, the app needs somewhere to keep session tokens, local encryption keys and user credentials. That is what the system stores are for: Keychain on iOS and Android Keystore. This article covers what may and may not go into code, how to use the system stores correctly and how to design an architecture in which real secrets never reach the device at all.

Why "hiding the key in code" does not work

It is no accident that first place in the OWASP Mobile Top 10 (2024) goes to M1: Improper Credential Usage, which includes keys hardcoded into the app. Here are the usual ways secrets get "hidden" and why they fail:

Hiding methodHow it is bypassedTime for an experienced analyst
String in code or Info.plist / strings.xmlUnpack the archive and search stringsMinutes
BuildConfig, .xcconfig, build variablesThe same values end up in the binaryMinutes
Base64 or XORDecode once the routine is foundMinutes to hours
Native library (NDK, C)Disassembler, or hooking the call on a rooted deviceHours
Fetching the key from a server at launchIntercepting traffic or process memoryHours

The time estimates come from our practical penetration-testing experience, not a formal metric. The point is that each approach raises the cost of an attack without changing the model: a key the app uses is available to whoever controls the device.

What may and may not ship in the build

Value typeIn the build?Condition or alternative
Firebase config (apiKey, projectId)YesIdentifiers, not secrets; access is enforced by Security Rules and App Check
Google Maps / Places SDK keyYes, restrictedRestrict by package name + SHA-1 / bundle ID and by API list
Public key for pinning or signature checksYesPublic by definition
Payment provider publishable keyYesOnly for client-side operations the provider intends
Payment provider secret keyNoBackend only
Cloud keys (AWS, GCP service account)NoBackend, or temporary least-privilege credentials
LLM / AI API keysNoProxy through the backend with authentication and limits
OAuth client secretNoPKCE for a public client, backend exchange if needed
JWT signing key, admin tokens, DB passwordsNo, neverServer only, in a secrets manager

Firebase states plainly in its documentation that Firebase API keys are not secrets and can be included in code, with protection provided by security rules. For Google Maps keys, Google recommends application and API restrictions and separate keys per platform.

A word on AI keys. An LLM API key inside an app is a direct route to a bill of thousands of dollars: it will be extracted and used for someone else's requests. Always proxy such calls through your backend, tied to a user, with limits and monitoring.

An architecture with no secrets on the device

The right question is not "how do I hide the key" but "how do I make the client not need it".

  1. The backend as intermediary. The app authenticates the user, gets their token and calls your API. Your server calls third-party services with its own secrets.
  2. Short-lived credentials. If the client needs direct access (say, uploading a file to object storage), the backend issues a signed URL or a token valid for minutes with minimal permissions.
  3. App integrity checks. App Attest on iOS and the Play Integrity API on Android let the server confirm a request comes from a genuine, unmodified copy of the app on a real device. That is not a secret in the build but a cryptographic attestation from the platform.
  4. Limits and monitoring. Even "public" keys deserve quotas and alerts on unusual usage.

iOS: Keychain and the Secure Enclave

Keychain Services is the system's encrypted store for small secrets: tokens, passwords, keys. Data is encrypted with hardware-protected keys and accessible only to your app (or an app group via Keychain Sharing).

The accessibility class is the key setting

The kSecAttrAccessible attribute determines when an item can be read (Apple documentation):

  • WhenUnlocked: only while the device is unlocked. Right for most data used on screen.
  • AfterFirstUnlock: after the first unlock since reboot. Needed if the token is used in the background (background refresh, push handling).
  • WhenPasscodeSetThisDeviceOnly: only if a passcode is set; the item is deleted if the passcode is removed.
  • The ThisDeviceOnly suffix keeps the item out of backups restored to other devices. For session tokens this is usually the right choice.

For sensitive actions, add access control with biometrics (SecAccessControl with .biometryCurrentSet): the item then cannot be read without Face ID or Touch ID, and access is invalidated when biometric enrolment changes.

For keys that must never leave the device, use the Secure Enclave: the private key is generated inside the coprocessor and cannot be exported; the app only asks it to sign or decrypt. The limitation: the Secure Enclave supports P-256 elliptic curve keys.

An often forgotten nuance: in practice Keychain items can survive app deletion. If users are unexpectedly signed in after reinstalling, clear the Keychain on first launch, keyed off a flag in UserDefaults.

Android: Keystore and data encryption

The Android Keystore stores cryptographic keys so their material never enters the app process: encryption and signing are performed by the system, on most modern devices in a hardware environment (TEE), and on devices with StrongBox (Android 9+) in a separate secure chip.

A typical scheme for tokens

  1. Create an AES key in the Keystore via KeyGenParameterSpec for encryption and decryption, in GCM mode.
  2. Encrypt the token with that key and store the ciphertext in DataStore or a file.
  3. For sensitive operations enable setUserAuthenticationRequired so the key works only after biometrics or a PIN (via BiometricPrompt with a CryptoObject).
  4. Where available, request StrongBox (setIsStrongBoxBacked) and provide a fallback when it is not.

An important change: Google deprecated the Jetpack Security library (EncryptedSharedPreferences, MasterKey) in 2025 in favour of platform APIs and direct use of the Keystore. Do not rely on it in new projects, and plan a migration in existing ones.

Backups

Keystore keys are not backed up, but data encrypted with them can be. After a restore on a new device, the app gets ciphertext without a key. Exclude such files via dataExtractionRules / fullBackupContent (Auto Backup) and handle decryption failures gracefully: clear the data and ask the user to sign in again.

Secrets in the repository and CI

Many leaks come not from the build but from git: a key committed "temporarily" stays in history forever.

  • Enable secret scanning: GitHub secret scanning with push protection, or gitleaks in pre-commit hooks and CI.
  • Keep environment configuration out of the repository; in CI, use encrypted variables or a secrets manager.
  • Store signing keys (the Android keystore, iOS certificates) separately, with restricted access and a backup. A lost Android upload key can be recovered through Play App Signing, but it is a support procedure.
  • If a secret reaches the repository, rotate it. Rewriting history does not help if someone already cloned it.

Common mistakes

  • Tokens in UserDefaults or plain SharedPreferences.
  • A payment or AI provider secret key in app code "because it is faster for the MVP".
  • Logging the Authorization header or token-bearing responses in release builds; tokens in crash reports and analytics.
  • The deprecated "Always" Keychain accessibility class, or AfterFirstUnlock with no background need.
  • No handling for a Keystore key becoming invalid (screen lock changed, new biometrics enrolled).
  • Google Maps keys without application restrictions.
  • Relying on obfuscation to protect secrets.

Secrets audit checklist

  1. Unpack your own release build and search for strings such as key, secret, token, sk_, AKIA.
  2. Build a register of every key in the build: purpose, whether it is a secret, which restrictions apply.
  3. Move every real secret to the backend; restrict client keys by application and quota.
  4. Tokens only in the Keychain (ThisDeviceOnly) or encrypted with a Keystore key.
  5. Add App Attest / Play Integrity for critical endpoints.
  6. Check logs, crash reports and analytics for tokens and personal data.
  7. Set up secret scanning in the repository and CI; rotate anything that ever landed there.
  8. Compare the implementation against the MASVS-STORAGE and MASVS-CRYPTO groups of OWASP MASVS.

Which tokens the app receives and how to refresh them is covered in our article on OAuth 2.0 + PKCE.

Sources: OWASP Mobile Top 10 (2024); OWASP MASVS; Apple: Keychain Services; Apple: Restricting keychain item accessibility; Apple: Protecting keys with the Secure Enclave; Android Keystore system; AndroidX Security release notes; Android Auto Backup; Firebase: API keys; Google Maps Platform: API security best practices; Apple: App Attest; Play Integrity API; GitHub: Secret scanning.

Passkeys: Implementing Passwordless Sign-In in iOS and Android Apps

Passkeys: Implementing Passwordless Sign-In in iOS and Android Apps

Passwords are the weakest link in most mobile products: users forget them, reuse them and type them into phishing pages, while the team spends resources on account recovery, SMS codes and support. Passkeys take a different approach: instead of a secret the person knows, a cryptographic key pair whose private key never leaves the user's credential manager, with sign-in confirmed by Face ID, a fingerprint or the device PIN.

The technology is supported by iOS, Android and every major browser, and Apple and Google have built it into their system password managers. This article covers how passkeys work, what the backend and mobile client need, how to design the migration UX away from passwords and the details teams trip over most often.

How passkeys work

A passkey is a FIDO2 credential built on the W3C WebAuthn standard and FIDO Alliance specifications. At registration the device generates a key pair for a specific domain (the relying party ID). The public key is stored on your server, the private key in a credential manager: iCloud Keychain, Google Password Manager or a third-party one such as 1Password.

At sign-in the server sends a random challenge, the device signs it with the private key after a biometric check, and the server verifies the signature with the public key. The consequences that matter:

  • Phishing resistance. The key is bound to the domain: a passkey for example.com cannot be used on example-login.com.
  • Nothing to steal on the server. A leaked database of public keys does not let anyone sign in.
  • Sync. Passkeys sync across devices within an ecosystem, and on someone else's device you can sign in by scanning a QR code with a nearby phone (cross-device, or the hybrid transport).

Passwords, SMS and passkeys compared

CriterionPasswordSMS / e-mail codePasskey
Phishing resistanceLowLow (the code can be entered on a fake page)High, bound to the domain
User frictionRemember and typeWait for and copy a codeOne biometric gesture
Cost to the businessRecovery, supportPaying per SMS, SMS pumping riskOne-off integration
Impact of a database leakCritical with weak hashing—Public keys grant no access
Device dependencyNonePhone number, SIMCredential manager, sync

NIST SP 800-63B permits syncable authenticators and recognises domain-bound cryptographic authentication, as in WebAuthn, as phishing-resistant, while it classifies using the phone network for SMS codes as restricted. For products handling sensitive data this is a compliance argument, not just a UX one.

What the backend needs

The backend is the relying party server. There is no need to write cryptography from scratch: use proven libraries (SimpleWebAuthn for Node.js, Yubico's java-webauthn-server, py_webauthn, webauthn-rs, libraries for PHP and Go). A list is available at passkeys.dev.

  1. Registration endpoints: issue creation options (challenge, rp.id, user.id, excludeCredentials) and verify the response.
  2. Sign-in endpoints: issue a challenge and verify the signature.
  3. A credentials table: credential ID, public key, signature counter, AAGUID (authenticator model), created and last-used dates. One user can have several passkeys.
  4. The challenge must be cryptographically random, single-use and short-lived (usually a few minutes).
  5. user.id must be a random value with no personal data; Google suggests, for example, 16 random bytes rather than an e-mail address.
  6. Origin checks: the domain for the web, and for Android android:apk-key-hash: with the SHA-256 fingerprint of the signing certificate (Android documentation). Remember to allow both debug and release fingerprints.

iOS: AuthenticationServices and Associated Domains

Passkeys are available from iOS 16 through the AuthenticationServices framework (Apple: Supporting passkeys).

  • Add the Associated Domains capability with a webcredentials:example.com entry.
  • Host an apple-app-site-association file at https://example.com/.well-known/apple-app-site-association with your App ID under webcredentials (Supporting associated domains). It must be served over HTTPS without redirects.
  • For registration use ASAuthorizationPlatformPublicKeyCredentialProvider with a registration request; for sign-in, an assertion request with the server's challenge.
  • For AutoFill-assisted sign-in, mark the login field as a username and the system will offer the passkey right in the QuickType bar.
  • From iOS 18, automatic passkey upgrades are available: after a successful password sign-in the app can request passkey creation in conditional mode, without an extra dialog.

Android: Credential Manager and Digital Asset Links

On Android the recommended tool is Jetpack Credential Manager, which unifies passkeys, passwords and Sign in with Google in a single system bottom sheet. Passkeys are supported on devices running Android 9 (API 28) and later.

  • Add the androidx.credentials and credentials-play-services-auth dependencies.
  • Set up Digital Asset Links: an assetlinks.json file at https://example.com/.well-known/ with the app's package, SHA-256 fingerprint and the credential-sharing permission.
  • Registration uses CreatePublicKeyCredentialRequest with the server's JSON; sign-in uses GetPublicKeyCredentialOption in getCredential().
  • Handle every exception: user cancellation, no credentials, interruption (retryable), missing provider configuration.
  • The isConditional flag lets you create a passkey automatically after a password sign-in, the counterpart of automatic upgrades on iOS.

If you use Google Play App Signing, assetlinks.json must contain the fingerprint of the key Google signs the app with, not just your upload key. This is the most common reason passkeys work in debug but fail in the production build.

UX: migrating users away from passwords

Dropping passwords overnight is unrealistic. A workable plan is gradual rollout:

StageWhat we doMetric
1. Offer after sign-inAfter a successful password sign-in, offer to create a passkey or create one automaticallyShare of users with a passkey
2. Passkeys in settingsA Security section: list of passkeys, add, remove, last used dateActive passkeys per user
3. Passkey-first sign-inThe sign-in screen offers the passkey first, the password as a fallbackShare of passkey sign-ins, sign-in success rate
4. Sign-up with a passkeyNew accounts are created with a passkey and no passwordSign-up conversion
5. Optional password removalA user with 2+ passkeys may delete their passwordAccess-related support tickets

Wording matters. Not everyone knows the word "passkey" yet, so explain the benefit: "Sign in with Face ID, no password needed". Google provides recommended copy and icons in its passkey UX guidelines. Do not show the offer on every sign-in: if the user declines, ask again in a few weeks.

Recovery and edge cases

  • Lost device. Synced passkeys are restored with the Apple or Google account. You still need a fallback: an e-mail link, a second passkey, recovery codes. Its security sets the security of the whole system.
  • Mixed ecosystems. A user with an iPhone and an Android tablet: the second device can sign in via QR code or create its own passkey. Support several passkeys per account.
  • Third-party password managers. 1Password, Bitwarden and others store passkeys too; do not restrict authenticators without reason.
  • A passkey deleted on the server. It stays in the user's manager and keeps being offered. Use the Signal API where available, or a clear error that offers another sign-in method.
  • Corporate devices. MDM policies may disable Keychain sync; test those scenarios if your product is B2B.

Common mistakes

  • rp.id not matching the domain in apple-app-site-association / assetlinks.json, or a redirect on those files.
  • Missing release (or Play App Signing) fingerprint in assetlinks.json.
  • An e-mail address or phone number as user.id.
  • Reusing challenges, or not verifying them on the server.
  • Passkey as the only sign-in path with no fallback.
  • Treating a user cancelling the dialog as an error and showing an alarming message.
  • No analytics: without metrics you cannot tell whether passkeys actually reduce friction.

Implementation checklist

  1. Backend on a proven WebAuthn library; multiple passkeys per user; single-use challenges.
  2. apple-app-site-association and assetlinks.json on the rp.id domain, over HTTPS, without redirects.
  3. Debug, release and Play App Signing fingerprints on the server and in assetlinks.json.
  4. iOS: Associated Domains (webcredentials), AutoFill-assisted sign-in, automatic upgrades on iOS 18+.
  5. Android: Credential Manager, every exception handled, isConditional for automatic creation.
  6. UX: offer after sign-in, a Security section, a passkey-first sign-in screen, clear copy.
  7. Fallback sign-in and recovery paths with at least equal security.
  8. Metrics: share of passkey sign-ins, sign-in success rate, access-related tickets.

Sources: FIDO Alliance: Passkeys; W3C Web Authentication Level 3; Apple: Supporting passkeys; Apple: Supporting associated domains; Android: Credential Manager; Android: Create passkeys; Android: Credential Manager prerequisites; Android: Passkeys UX guidelines; Google Identity: Passkeys; passkeys.dev; NIST SP 800-63B.

Mobile App Authentication: OAuth 2.0 with PKCE, Access and Refresh Tokens

Mobile App Authentication: OAuth 2.0 with PKCE, Access and Refresh Tokens

Authentication is one of the few parts of a mobile app where "works" and "correct" can be very far apart. Sign-in through a WebView that can read the password, a refresh token living forever in SharedPreferences, several parallel token refreshes that end up signing the user out: all of these "work" until the first security audit or the first incident.

This article is a practical walkthrough of OAuth 2.0 with PKCE for native apps: what the flow looks like, why WebViews are off the table, how to choose token lifetimes, how to refresh without race conditions and what to do on sign-out. It is grounded in current IETF standards, primarily RFC 8252 and RFC 9700.

Why a mobile app is a "public client"

In classic OAuth a server-side application holds a client secret stored on the server. A mobile app cannot keep a secret: any string in the build can be extracted by decompilation in minutes. So the specification classifies native apps as public clients, and RFC 8252 (OAuth 2.0 for Native Apps) requires two things: use an external user agent (the system browser) and protect the code exchange with PKCE.

The takeaway for the team is simple: no client secret in the mobile build. If a provider insists on one, the code-for-token exchange must happen through your backend.

Authorization Code + PKCE, step by step

  1. The app generates a code_verifier, a random 43–128-character string, and computes code_challenge = BASE64URL(SHA-256(code_verifier)), as described in RFC 7636. Avoid the plain method.
  2. It opens the authorisation page in the system browser with client_id, redirect_uri, scope, state, code_challenge and code_challenge_method=S256.
  3. The user signs in on the provider's page: password, passkey, 2FA, Google or Apple sign-in. The app never sees these details.
  4. The provider redirects to redirect_uri with a one-time authorisation code and the state. The app checks that the state matches what it sent.
  5. The app exchanges the code for tokens, including the original code_verifier. The server checks that its hash matches the code_challenge.
  6. The app receives an access token, a refresh token and, with OpenID Connect, an ID token, and stores them in secure storage.

PKCE solves a specific problem: if a malicious app intercepts the redirect carrying the code (for example by registering the same custom URL scheme), it cannot redeem the code without the code_verifier, which never left your app's memory.

System browser, not a WebView

An embedded WebView gives the app full control over the sign-in page: it can read the typed password and the cookies. That is why RFC 8252 explicitly rules it out for authorisation, and since 2021 Google has blocked Google sign-in in embedded WebViews. The right tools:

PlatformToolWhat you get
iOSASWebAuthenticationSessionA system browser sheet, optional Safari cookie sharing, return via callback
AndroidCustom TabsA browser tab over the app, with the browser's password manager and passkeys
BothAppAuth librariesA ready-made flow implementation, PKCE, redirect handling

On iOS that is ASWebAuthenticationSession, on Android Custom Tabs, and the open-source AppAuth libraries implement the whole flow on both platforms. A bonus for users: password managers and saved sessions work, so sign-in gets faster.

Redirect URI

The safest option is a domain-verified HTTPS link: Universal Links on iOS and App Links on Android. RFC 8252 permits a custom scheme (com.example.app:/callback), but another app can register it too, which is exactly why PKCE is mandatory. Use a reverse-domain scheme rather than something short like myapp://.

Access and refresh tokens: lifetime and rotation

The access token is short-lived and sent with every API request. The refresh token lives longer and is used only to obtain new access tokens. Exact values depend on the product's risk profile; these are the guidelines we use:

Product typeAccess tokenRefresh tokenExtra measures
Content, media, social15–60 min30–90 days, slidingRefresh token rotation
E-commerce, delivery10–30 min30–60 daysRe-authentication to change payment details
Finance, health5–15 minHours to days, absolute session capBiometrics for sensitive actions, device binding

RFC 9700 (OAuth 2.0 Security Best Current Practice) recommends that public clients either bind refresh tokens to a client key (for example with DPoP) or use rotation: every refresh issues a new refresh token and invalidates the old one. If the server sees an already invalidated token being reused, that signals theft and the whole token family should be revoked.

Refreshing without race conditions

A typical bug we find in audits: on returning from the background the app fires five requests at once, all get 401, and all five refresh the token in parallel. With rotation, the first gets a new refresh token, the other four present the invalidated one, the server detects "reuse" and signs the user out.

The correct pattern

  1. All requests go through one HTTP client with an interceptor (OkHttp Authenticator on Android, a wrapper around URLSession on iOS).
  2. On 401 the interceptor checks whether a refresh is already in progress. If so, it waits for that result instead of starting another (mutex, actor or single-flight).
  3. After a successful refresh, all queued requests are retried with the new access token. Each request is retried at most once.
  4. If the refresh fails with invalid_grant, clear the tokens and send the user to sign-in while preserving context (where they were heading).
  5. Do not confuse a network error during refresh with invalid_grant: never sign a user out just because they are offline.

A useful optimisation is proactive refresh: if the access token expires in under a minute, refresh it before the request rather than after a 401.

Storing tokens

Tokens are secrets and must be stored accordingly: Keychain on iOS, Android Keystore (for example, a key that encrypts the storage) on Android. Never UserDefaults, plain SharedPreferences, logs, analytics or crash reports. Make sure the debug HTTP logger does not ship in release builds and does not print the Authorization header. We will cover storage in depth in a separate article on Keychain and Keystore. Baseline authentication and storage requirements are collected in OWASP MASVS (the MASVS-AUTH and MASVS-STORAGE groups).

Sign-out and revocation

  • Revoke the refresh token on the server via the revocation endpoint (RFC 7009), not just delete it from the device.
  • Clear local data: caches, database, user files, the push token on the backend.
  • End the browser session if SSO is used; otherwise the next sign-in silently reuses the same account, which surprises users on shared devices.
  • Let users end other sessions from settings: a device list and a "Sign out everywhere" button.
  • After a password change, revoke every refresh token except the current one.

Common mistakes

  • Sign-in in a WebView, or a native form sending the password straight to the OAuth server (Resource Owner Password Credentials, a grant RFC 9700 says must not be used).
  • The implicit flow with a token in the URL fragment: deprecated and not recommended.
  • A client secret in app code or a build configuration file.
  • No state check, or PKCE with the plain method.
  • A non-expiring refresh token without rotation.
  • Parallel token refreshes that sign the user out.
  • Signing out on any network error during refresh.

Implementation checklist

  1. Authorization Code + PKCE (S256), state validation.
  2. System browser: ASWebAuthenticationSession / Custom Tabs, or AppAuth.
  3. Redirect via Universal Links / App Links or a reverse-domain scheme.
  4. No secrets in the build; confidential exchanges go through the backend.
  5. Short-lived access tokens, refresh token rotation with reuse detection.
  6. Single-flight refresh in the network layer, one retry per request.
  7. Tokens only in Keychain / Keystore, never in logs or analytics.
  8. Server-side revocation on sign-out, "sign out everywhere", revocation after a password change.
  9. Tests: expired token, parallel 401s, sign-out while offline, returning from the background after a week.

Sources: RFC 8252: OAuth 2.0 for Native Apps; RFC 7636: PKCE; RFC 9700: OAuth 2.0 Security Best Current Practice; RFC 7009: Token Revocation; RFC 9449: DPoP; Apple: ASWebAuthenticationSession; Chrome Custom Tabs; AppAuth; Google: OAuth in embedded WebViews; OWASP MASVS.

Android Developer Verification: Global Launch in January 2027 and a Checklist for Your Team

Android Developer Verification: Global Launch in January 2027 and a Checklist for Your Team

Google is preparing a global launch of Android developer verification. The protections have been live since 30 September 2026 in Brazil, Indonesia, Singapore and Thailand, and the global rollout begins in January 2027. Here is what changes and what your team should do now.

All facts come from the Android Developers Blog post.

What is happening

Verification was announced in 2025 as an extra security layer that makes it harder for bad actors to repeatedly spread harm. After more than a year of preparation with partners, protections went live for participating stores in four countries. The global rollout starts in January 2027 with seven distributors: Google Play, Galaxy Store, Honor, Oppo, Xiaomi, Transsion and Vivo. Over several months the protections will expand to all countries and all installation sources on certified Android devices.

Registration so far

According to Google, millions of apps have been registered since verification opened to everyone in March. They represent over 99% of all Android app installs globally, via any distribution channel.

What was added based on developer feedback

  • Limited distribution accounts for students and hobbyists: share apps without registration fees or a government ID check. The authorized-device limit grew from 20 to 50.
  • Android Developer ID Status API and Android Developer Console API: automate app registration from CI pipelines for teams with many apps.
  • An advanced flow for power users: install an unregistered app by knowingly accepting the risk, while guardrails against social-engineering scams stay in place for everyday users.

A checklist for your team

  • You publish on Google Play: check package registration status in Play Console and register any unregistered apps, including those you distribute outside Play.
  • You distribute only outside Google Play: create an Android Developer Console account, verify your identity and register your apps.
  • You publish on open-source registries: Google has a dedicated guide for registering existing and new apps.
  • You manage many apps: consider registering through the API from CI instead of by hand.

Google says registering an app takes under ten minutes. The risk of skipping it is that installing your app stops being seamless wherever the protections are live.

Bottom line

There is little time before January, and the work is simple: inventory packages, verify the account, register the apps. Teams that hand out builds outside Google Play (enterprise, regional and test channels) should be especially careful.

Google Play Requirements Due January 27, 2027: Contacts, Location, Call Logs, Subscriptions

Google Play Requirements Due January 27, 2027: Contacts, Location, Call Logs, Subscriptions

In plain terms: Google Play has updated its rules on personal data and several technical capabilities, and the Policy Deadlines page in Play Console lists January 27, 2027 for part of these changes. If your app touches contacts, precise location, the call log, geofences or discounted subscriptions, this concerns you. Below is each change, what it means in practice and where to start checking.

Three dates to put in your calendar

DateWhat changes
January 27, 2027Contacts, location, READ_CALL_LOG, geofencing in foreground services, subscriptions with ongoing eligibility-based discounts
April 14, 2027The AppFunctions API must comply with Google Play policies
August 25, 2027Local Network and Manage Contacts: restrictions and Play Console declarations

Dates come from the Play Console Help "Policy Deadlines" page. Check it before planning work, since Google may refine the timelines.

1. Contacts: Contact Picker instead of broad access

Apps that do not need broad access to contacts must use the Android Contact Picker. It is a system picker where the user chooses the contacts to share and the app receives only those. It is available from Android 17, needs no permission and collects less data.

A related platform change: apps that target the next Android release will no longer be able to write to contacts directly with WRITE_CONTACTS. Instead you use the ACTION_INSERT, ACTION_EDIT and ACTION_INSERT_OR_EDIT intents, which need no permission. For a small set of apps with broad needs (for example contact managers or background sync with an enterprise account) a special MANAGE_CONTACTS permission arrives, with a declaration in Play Console. This does not affect apps targeting older versions.

What to check: search your code for WRITE_CONTACTS, direct ContactsContract writes and applyBatch, replace user-initiated actions with intents, and decide whether you really need broad access.

2. Location: the location button as the minimum scope

The updated policy names the location button as the recommended minimum scope for precise location. In practice: if your app requests precise location, justify why it is needed continuously and consider a flow where location is requested at the moment of the user's action. We wrote about the consequences of background access in our article on location and background tasks.

3. READ_CALL_LOG: phone-call verification no longer fits

Account verification through a phone call is no longer a permitted use of READ_CALL_LOG. If your sign-in or number confirmation relies on reading the call log, you will need to replace that flow with a different verification method.

4. Geofencing in foreground services

Geofencing has been removed from the approved foreground service use cases. For these scenarios Google points to the Geofence API. If your app keeps a notification-bearing service running only to track geofences, its architecture needs a second look.

5. Subscriptions with eligibility-based discounts

Subscriptions with ongoing eligibility-based discounts (for example student or regional pricing) must clearly disclose the eligibility criteria, the verification process and the price after eligibility ends. Check your paywall, your Play Console listing and the subscription management screen: all of it should be clear before purchase. For monetization models, see also our piece on subscriptions versus one-time purchases.

What comes next: 2027

By April 14, 2027 the AppFunctions API must comply with Google Play policies: deceiving or manipulating AI agents, bypassing security controls or interfering with other apps is prohibited. By August 25, 2027 Local Network access is restricted to apps that need it for core functionality when system pickers are insufficient, and apps targeting Android 17 (API 37+) must submit a declaration in Play Console. The same logic applies to the Manage Contacts permission.

January checklist

  1. List every sensitive permission in your manifest: contacts, precise location, call log, foreground services.
  2. For each, write down which feature it enables and whether narrower access would do.
  3. Replace broad contact access with the Contact Picker and intents.
  4. Review discounted subscriptions: criteria, verification, price after the discount ends.
  5. Update Data safety and your privacy policy, as described in our article on privacy manifests, ATT and Data safety.
  6. Add these checks to your release checklist.

The rule across all of these changes is the same: request the minimum access, explain it to the user, and build sensitive capabilities on system components.

Sources: Play Console Help: Policy Deadlines; Play Console Help: Google Play Policy Update, April 15, 2026; Android Developers Blog: A more reliable way to add and edit contacts on Android.

Mobile Financial Services in 2025: Lessons from the Mobile Money Experience

Mobile Financial Services in 2025: Lessons from the Mobile Money Experience

A financial app has to satisfy two opposing requirements: it must be extremely simple for an everyday action and extremely dependable when money is involved. The mobile money experience — services where an account is tied to a phone number and a transfer can be made even from a basic handset — shows that accessibility and trust must be designed together, not one after the other.

This article collects what we see in the financial and payment flows of our projects: where exactly users lose trust, which technical decisions prevent duplicate charges, and which metrics reveal a problem before the support team does.

The scale of mobile money: what the data says

According to GSMA’s State of the Industry Report on Mobile Money 2025 (published in 2025 with 2024 data), there are about 2.1 billion registered mobile money accounts worldwide, up 14% year on year. More than 514 million people use them every month, and annual transaction value reached roughly $1.68 trillion. In other words, billions of dollars move through these accounts every day.

For a product team, the most telling figure is the gap between registered and active accounts: only about a quarter of accounts are used monthly. Registration is the easy part; the real challenge is getting someone to trust the service with their money a second, tenth, and hundredth time. This is especially visible in markets where a phone and a mobile number are a more accessible entry point to finance than a bank branch.

Indicator (2024)ValueWhat it means for the product
Registered accounts≈2.1 billion, +14% YoYGetting in is no longer the barrier; competition is about regular use
Monthly active accounts≈514 million, +11% YoYThe key metric is repeat transactions, not sign-ups
Annual transaction value≈$1.68 trillionThe cost of a payment-flow bug is measured in users’ real money

Three principles for reliable financial UX

  1. Confirm before an irreversible action. Amount, recipient, fee, and total debit should appear on one screen before the button is pressed. If the fee appears only after confirmation, users read it as a hidden charge, even when the amount is tiny.
  2. Make status clear. Users should know whether a payment is processing, complete, declined, or needs action. An unexplained “something went wrong” is the most common cause of retries and support tickets.
  3. Recover from errors. A failed request must not create a duplicate charge or erase history. If the connection drops at the moment of sending, the app should be able to find out what actually happened instead of blindly suggesting “try again.”

These principles sound obvious, yet in the financial projects we audit the third one breaks most often. The interface shows a timeout, the user taps the button again, and the server has meanwhile already processed the first request successfully.

The technical foundation of trust: idempotency and payment states

Protection against double charges cannot depend on whether the user notices a spinner. It has to be built into the client–server protocol.

The step-by-step scheme we use

  1. The client generates a unique operation key (UUID) when the user opens the confirmation screen and stores it locally together with the payment parameters.
  2. Every send attempt, including a retry after a network drop, carries the same key. When the server sees a known key, it returns the result of the first request instead of creating a new transaction. This is how idempotent requests in the Stripe API work.
  3. The payment has an explicit state machine: created → processing → succeeded / declined / requires action. The interface shows only these states, with no intermediate “technical” ones.
  4. After a timeout, the client does not retry endlessly; it queries the status by operation key with exponential backoff (for example 1, 2, 4, 8 seconds) and tells the user it is checking the result.
  5. If the status stays undetermined beyond a reasonable threshold (in our projects usually 30–60 seconds), the operation moves to a “checking” state, appears in history, and the user receives a push notification once the final decision arrives.

This removes an entire class of “I was charged twice” tickets and gives support an identifier that finds the operation in seconds.

Security without punishment

Security should not feel like punishment. Ask for additional verification when the risk justifies it, rather than repeating the same steps in every session. A transfer to a familiar recipient for a usual amount from the same device and a first large transfer to a new recipient from a new phone are different levels of risk and deserve different friction.

  • Sign-in: system biometrics (Face ID, BiometricPrompt) with a PIN fallback; a full password only when the device changes.
  • Sensitive actions: a new recipient, a changed phone number, limit, or device — re-authentication and, where needed, a delay or confirmation through another channel.
  • Messages: errors should not reveal unnecessary details. “Wrong PIN, 2 attempts left” is helpful; “no account exists for this number” is a hint for an attacker.
  • Storage: tokens go into Keychain / Android Keystore; no card numbers or secrets in logs and analytics. OWASP MASVS is a convenient requirements checklist.

What to measure

Beyond transaction volume, the team should track indicators that reflect trust and stability. Below is the set we usually start with. Thresholds are guidelines from our experience, not an industry standard.

MetricHow to calculateWarning signal (studio experience)
Successful-payment rateSucceeded / all initiated operationsA drop of 1–2 pp after a release
RetriesOperations with the same key, or same recipient and amount within 5 minutesMore than 3–5% of operations
Time to confirmationFrom tapping “Pay” to final status, p50 and p95p95 longer than 10 seconds
Fraud-related contactsContacts per 10,000 active usersA sharp rise without an audience change
Verification drop-offShare who started KYC and did not finishA single step loses more than 20% of people

For a financial product, reliability and clarity are business metrics. It is also worth tracking return after 7 and 30 days following the first successful operation: that is what shows whether trust has formed.

Common mistakes in financial apps

  • The fee or exchange rate appears only after confirmation.
  • The pay button stays active during processing, and a double tap creates two requests.
  • A network error and a bank decline show the same message.
  • Transaction history refreshes only after an app restart.
  • The same strict check for every action, pushing users toward workarounds or out of the service.
  • Analytics events contain personal or payment data.

Remember people with affordable devices and unstable connections as well; we covered this audience in more detail in our article on 4.7 billion mobile internet users.

Checklist before launching a payment flow

  1. Amount, recipient, fee, and total are visible on one screen before confirmation.
  2. Every operation has an idempotency key; a retry never creates a duplicate.
  3. Payment states are explicit, and there is a flow for an undetermined result.
  4. The button locks after the first tap until a response arrives.
  5. Additional authentication depends on the operation’s risk.
  6. Error messages are clear but reveal nothing unnecessary.
  7. Success rate, retries, time to confirmation, and KYC drop-off are instrumented.
  8. The product’s financial outcome is tied to business indicators — see our article on whether a mobile app pays off.

The best mobile money experience does not look complicated. It hides system complexity while keeping control, explanations, and a safe recovery path in the user’s hands.

Sources:GSMA: The State of the Industry Report on Mobile Money 2025; GSMA: Mobile Money and the Mobile Economy; OWASP MASVS; Stripe API: Idempotent requests.

Journal

Ideas and products