The Secure Login Journey: What Happens When You Tap Sign In

A secure app never touches your password. It hands you to Microsoft Entra ID, gets back a signed token, and that token is all your API ever sees.

Suthahar Jegatheesan By Suthahar Jegatheesan Published

Azure 6 min read —views
Article banner. On the left, the eyebrow "Azure, Securing a Mobile App" above the title "Tap Sign in. No password." and the line "Your API never sees it. Here is where the token goes.", with the MSDEVBUILD wordmark and the author name below. On the right, three stacked boxes joined by arrows: a grey box reading "The app hands off to Microsoft's sign-in page", an arrow labelled "the password" to an amber box reading "Password stops at Entra ID, a signed token comes back", and an arrow labelled "the token" to a green box reading "Verified locally, managed identity, no password past step 2".

Priya opens a food delivery app at 7pm, hungry, and taps Sign in. About a second and a half later she’s looking at her past orders.

In that second and a half, her password went to exactly one place. It wasn’t the app. It wasn’t your API. It definitely wasn’t your database. This post follows that one tap all the way down, because once you’ve seen the journey, it’s very hard to go back to building your own login form.

What happens when you tap “Sign in” on a secure app?

A secure app never handles your password. It hands you to Microsoft Entra ID, Entra ID checks who you are, and the app gets back a signed token: that token, not the password, is what every system after that point sees.

Six steps drawn top to bottom, each with an icon. 1, a phone: Priya taps Sign in and the app opens Microsoft's sign-in page instead of its own password box. 2, a globe: she types her password on Microsoft's page, and only Microsoft sees it. A red dashed line below this step reads "her password never goes below this line". 3, a bell: she approves on her phone (MFA), so a stolen password alone is useless. 4, a shield with a tick: Microsoft hands back a signed pass, the token, which says who she is and expires in about an hour. 5, the App Service icon: your API checks the pass by itself, without calling Microsoft. 6, the Azure SQL icon: the API opens the database with its own managed identity, so no password exists in code, config or the database. A green box at the end reads "Her password went to exactly one place: Microsoft."

Figure 1 — one sign-in, in plain English. The password exists only above the red line.

Step by step: where the password goes

1. The app hands off (about 20ms). It opens the system browser, or a secure web view, on the Microsoft sign-in page. Not a text field the app drew itself. This sounds like a detail. It’s the whole thing: if your app renders the password field, your app has the password, and every promise you make after that is on trust.

2. The password stops at Entra ID. It travels to Microsoft and nowhere else. Your API isn’t in this step and never will be. If your database leaks tomorrow, there are no passwords in it. You never had any.

3. MFA: the slow bit, and it’s her, not the system. Priya approves the prompt on her phone. That’s what makes a stolen password worthless. It matters a lot, because password reuse is exactly what credential-stuffing bots run on (more on those in the post on automated login attacks).

4. A signed token comes back (about 1.4 seconds in). A JWT: who she is, what she’s allowed to do, when it expires, and Microsoft’s signature over all of it. Usually valid for 60–90 minutes. The app stores it in the iOS Keychain or Android Keystore, never in UserDefaults or SharedPreferences.

5. Your API verifies it locally (microseconds). This is the step people assume is a network call. It isn’t. Your API downloaded Microsoft’s public signing keys once, cached them, and now checks every token on its own.

6. No password below the API either. Your API reaches Azure SQL with a managed identity:

Server=msdev.database.windows.net;
Authentication=Active Directory Default;

No password in the connection string. Nothing to leak, nothing to rotate.

What does the API check on every token?

Four things, and all four matter:

CheckWhat it provesWhat goes wrong if you skip it
SignatureMicrosoft issued it and nobody edited itAnyone can forge a token
Issuer (iss)It came from your tenantA token from another tenant gets in
Audience (aud)It was issued for this APIA valid token for a different app works on yours
Expiry (exp)It’s still in dateA token stolen last week still works

The part that surprises people

After step 2, there’s no password anywhere. Not in the app. Not in your config, the connection string or the database. The only thing moving through the system is a short-lived signed token. It expires on its own.

What happens after the token expires

The access token expires after about an hour. A refresh token quietly gets a new one in the background, which is why a well-built app doesn’t sign you out every 60 minutes, and it’s also why a stolen access token is a much smaller problem than a stolen password. It stops working by itself, soon.

How to check your own app

Open your login screen and look for a password field you built, because if it’s there, your app is handling passwords. Nothing above applies to you yet. Moving to MSAL and the system browser is the change that makes it apply. It’s usually less work than the login form you’d be deleting.

Key takeaways

  • A secure app never renders its own password field — it hands the user to Microsoft’s sign-in page via the system browser.
  • The password reaches Microsoft Entra ID and stops there; your API and database never see it.
  • Token verification is a local check against cached signing keys, not a network call per request.
  • Check signature, issuer, audience and expiry — a valid signature doesn’t mean the token was meant for your API.
  • Reach Azure SQL with a managed identity, so no password exists anywhere past sign-in.

Earlier in this series: Insecure vs Secure: The Same Mobile App, Two Azure Architectures and Azure Key Vault Explained: The One Secret Tutorials Never Remove.

Was this useful?

Share

Found a mistake or an outdated step? Edit this page on GitHub

Frequently asked questions

Does a mobile app's API ever see the user's password?
Not in a secure design. The app opens the system browser on Microsoft's own sign-in page, so the password goes to Microsoft Entra ID and stops there. Your API only ever receives a signed, short-lived token that proves who the user is.
Why does a secure mobile app open a system browser instead of its own login form?
Because if the app renders the password field, the app has the password, and every promise about security after that point rests on trust alone. Handing off to the system browser means the password travels to Microsoft Entra ID directly and is never visible to the app's own code.
How does an API verify a JWT without calling Microsoft Entra ID on every request?
It downloads Microsoft's public signing keys once from the OpenID configuration endpoint and caches them, then checks the signature, issuer, audience and expiry entirely offline. That costs microseconds rather than a network round trip. All four checks matter: a valid token issued for another application is still valid.
Where should a mobile app store the access token?
In the platform's secure store: the iOS Keychain or the Android Keystore (SecureStorage in .NET MAUI). Never in UserDefaults or SharedPreferences, which are plain files readable on a rooted or jailbroken device and from device backups.
Does a database need to store user passwords in a Microsoft Entra ID login flow?
No. The password stops at Entra ID and never reaches the application's own API or database. The API connects to Azure SQL with a managed identity, so there is no password anywhere in the chain after sign-in — nothing to leak if the database is ever compromised.
Article banner. On the left, the eyebrow "Azure, Securing a Mobile App" above the title "Five attacks, five defences" and the line "One Azure backend, and the named control that stops each attack.", with the MSDEVBUILD wordmark and the author name below. On the right, three stacked boxes joined by arrows: a grey box reading "Junk, no token, wrong id, keys in a repo, a direct DB dial", an arrow labelled "five attacks" to an amber box reading "Each needs its own door, one missing door is enough", and an arrow labelled "five controls" to a green box reading "WAF, Entra ID, owner check, Key Vault, private endpoint".

Read next

4 min

Hacker vs Azure: Five Attacks and the Five Defences That Stop Them

Five real attacks on a mobile backend, matched one-for-one to the Azure service that stops each — and the default setting that quietly undoes the last one.

Continue reading
Part 9 of 10Insecure vs Secure: The Same Mobile App, Two Azure Architectures

Get new posts by email

New technical articles, Azure AI and GitHub Copilot updates, and upcoming events. No spam, unsubscribe anytime.

Comments

Your turn

How did Suthahar's articles help you?

If something here saved you time or unblocked a real project, I'd love to hear about it. Submissions are reviewed before they appear on the site.

0/1500 · minimum 10 characters

Never published — used only to verify your feedback.

Your name, company, and role appear publicly if published. Nothing else is collected.

↑↓ navigate ↵ open