Mobile App Authentication Explained: JWT, OAuth, and Biometric Login

Every time a user logs into your app, checks a bank balance or sends a message, an API is working behind the scenes. Before it returns any data, it has to answer two questions: who is asking, and are they allowed to see this? That is what authentication is for. This guide explains the main ways mobile apps handle it, API keys, JWT, OAuth and biometric login, in plain language, with simple diagrams and clear advice on when to use each one.

In short: use JWT to keep users logged in, OAuth for “Login with Google” style sign-in, biometrics to unlock the app quickly on the device, and keep API keys on your server, not inside the app.

Authentication vs authorization

These two words are often mixed up, but they answer different questions.

  • Authentication answers “Who are you?” It verifies the identity of the user or app, like checking an ID at the door.
  • Authorization answers “What are you allowed to do?” It decides what an identified user can access. A regular user may only view their profile, while an admin can edit users.
Authentication checks who you are while authorization checks what you can do
Authentication vs authorization.

Without authentication, anyone who knows your API address could read data, change records or even shut systems down. With it, you can also control access per user, track who uses your API and apply rate limits so one client can’t overwhelm it.

API keys

An API key is a long, random string that identifies an application. The app includes the key with each request, and if it is valid, the API lets the request through. Think of it as a password for an application, not for a person.

How to send it: put the key in the request header, not in the URL. URLs can end up in logs and browser history, which exposes the key.

Good for Not good for
Public APIs such as weather, maps or market data Handling sensitive user data
Server-to-server and internal microservices Per-user permissions (keys have no built-in user identity)
Usage tracking and rate limiting Anything needing expiry or fine-grained control

Mobile warning: never hard-code a secret API key inside your app. Anyone can extract it. Keep it on your own server, and let the app talk to that server instead.

JWT (JSON Web Tokens)

A JWT is a compact, self-contained token that proves who the user is. After login, the app sends the token with each request instead of the password. It works like a wristband at an event: once you have it, anyone who scans it knows who you are and where you can go.

The three parts of a JWT

A JWT has a header, a payload and a signature
The three parts of a JWT.
  • Header: the token type and the signing algorithm.
  • Payload: the data, such as user ID, role and expiry time.
  • Signature: proves the token is genuine and hasn’t been tampered with.

Because the server can verify the signature without looking anything up, no session needs to be stored. That makes JWT stateless and easy to scale.

Good to know: a JWT is signed, but its payload is only encoded, so anyone holding the token can read it. Never put passwords or secrets inside it.

How JWT login works

JWT login flow between the app and the server in five steps
JWT login, step by step.
  1. The user logs in with email and password.
  2. The server checks them and returns a JWT.
  3. The app stores the token. On mobile, use the platform’s secure storage (Keychain on iOS, Keystore on Android), not plain storage.
  4. For each request, the app sends the token in the Authorization header.
  5. The server checks the signature and expiry, then returns the data.

Tip: give access tokens a short life, and use a refresh token to get a new one, so a stolen token stops working quickly.

OAuth 2.0 and “Login with Google”

OAuth is a protocol that lets a user give an app limited access to their account without sharing their password. When you tap “Login with Google”, the app never sees your Google password. Instead, Google gives the app a token with only the permissions you approved.

OAuth login with Google in five steps
OAuth: how “Login with Google” works.

This flow also explains why OAuth is the standard for third-party access, such as scheduling posts or reading repositories on someone’s behalf. Access tokens can expire and be revoked, which gives fine control. For mobile apps, use the authorization code flow with PKCE, which is the recommended secure setup.

JWT vs OAuth: not rivals

JWT is a token, a thing that gets passed around. OAuth is a protocol, a process for granting access. OAuth often uses a JWT as the token it hands out, but it can use other kinds too, and JWT can be used on its own in a simple app and backend.

JWT is like an ID card and OAuth is like a valet key
JWT is an ID card, OAuth is a valet key.

Biometric login

Fingerprint and face unlock are popular because they are fast and convenient. But biometrics don’t replace server authentication. They are a local check that unlocks something already saved on the device.

Biometric login: scan, local check, unlock saved token, send token to server
How biometric login works on the phone.
  1. The user logs in once with a normal method (password, OAuth).
  2. The app saves the token in secure storage.
  3. Next time, the user scans a finger or face. The operating system checks it locally.
  4. If it matches, the saved token is unlocked and sent to the server as usual.

The biometric data itself stays on the phone and is never sent to your server. On iOS this uses the LocalAuthentication framework (Face ID, Touch ID), and on Android it uses BiometricPrompt. Cross-platform packages exist too, such as local_auth for Flutter and expo-local-authentication for React Native. Always offer a fallback, like a device passcode or password, for when biometrics fail.

Which method should you use?

Method Best for Watch out for
API key Simple server-to-server calls, public APIs No expiry or per-user control; never ship it in the app
JWT Keeping users logged in, scalable stateless apps Store securely; keep tokens short-lived
OAuth 2.0 Social login and third-party access More setup; use PKCE on mobile
Biometrics Fast, convenient unlock on the device Local only; needs a fallback and secure token storage
Basic auth Quick tests only Credentials sent with every request; use only over HTTPS

Most real apps combine them: OAuth or a password for the first login, a JWT to stay logged in, and biometrics to unlock quickly.

Mistakes and FAQ

Mistake Why it hurts
Hard-coding an API key in the app It can be extracted by anyone
Putting keys or tokens in URLs They end up in logs and history
Storing tokens in plain storage Easier to steal from the device
Long-lived access tokens A stolen token works for too long
Treating biometrics as the only check It only unlocks the device, not the server
Mixing up authentication and authorization Users may reach data they shouldn’t

What is the difference between authentication and authorization?

Authentication verifies who you are. Authorization decides what you are allowed to do after that.

Is JWT better than an API key?

They solve different problems. API keys identify an application. JWTs identify a user and can carry roles and an expiry time.

Is OAuth the same as JWT?

No. OAuth is a protocol for granting access, and JWT is a token format. OAuth may use JWT as its token.

Is biometric login safe?

Yes, when it unlocks a token kept in secure storage and the biometric data never leaves the device. Provide a fallback for when it fails.

Where should a mobile app store tokens?

In the platform’s secure storage: Keychain on iOS and Keystore on Android.

Conclusion

Authentication is how your app knows who it is talking to, and getting it right protects both your users and your data. Use OAuth or a password for the first sign-in, a short-lived JWT to keep users logged in, biometrics for quick unlock, and keep your API keys on the server. Keep authentication (who you are) separate from authorization (what you can do), store tokens securely, and your app will be safer without making login painful for users.

Leave a Reply

Your email address will not be published. Required fields are marked *