Federated Identity: Let a Trusted Provider Sign Users In
Learn how an app hands sign-in to a trusted identity provider, reads the signed token it gets back, and when this design is worth its trade-offs.
In short
Federated identity lets an app hand sign-in to a trusted identity provider and then read the signed token the provider sends back.
10 min readFree
What You Will Learn
Many apps ask you to make an account with an email address and a password. The app then has to keep that password safe and check it every time you come back. Federated Identity is a different design. The app hands the sign-in job to a separate, trusted service, and it accepts that service's answer.
This lesson covers the roles in the design, how the sign-in flow works step by step, how an app reads the proof it receives, and the trade-offs. You will also see a simple test for deciding when this design is worth the effort.
Key words
- Federated Identity
- A design where an app trusts an outside service to confirm who a user is, instead of checking passwords itself.
- Authentication
- Proving who you are, for example with a password, a code, or a fingerprint.
- Authorization
- Deciding what a signed-in person is allowed to do, such as reading or editing a file.
- Identity provider (IdP)
- The outside service that holds user accounts, checks users, and vouches for them. Examples are Google, Microsoft Entra ID, or a company's own login system.
- Relying application
- The app that trusts the identity provider and uses its answer to let people in.
- Token
- A small digital message that carries facts about a sign-in.
- Claim
- One fact inside a token, such as an email address, a user ID, or a role.
- Signature
- A mark made with a secret key. Anyone with the matching public key can check that the message came from its owner and was not changed.
- Session
- The period during which an app remembers that you are signed in.
- Single sign-on (SSO)
- Signing in once and then reaching several apps without signing in again.
- Federation
- The trust arrangement between separate services that lets one of them vouch for users of the others.
- OpenID Connect (OIDC)
- A sign-in standard built on top of OAuth 2.0. It sends the result of a sign-in as an ID token.
- SAML
- An older sign-in standard that uses XML, a text format that marks up data with tags. It sends the result as an assertion, a signed XML message.
- Social login
- Signing in with an account you already have on a public platform, such as Google.
What Are the Three Roles and the Trust Link?
Federated Identity involves three parties. The user is the person who wants to get in. The identity provider holds the user's account and checks their proof of identity, usually a password. The relying application is the app the user wants to use. It trusts the identity provider, so it never needs its own copy of the user's password.
The design depends on trust. Before any user signs in, the app and the provider agree on how to recognise each other's messages. The provider signs what it sends, and the app checks that signature. This setup is done ahead of time, not each time someone logs in.
User
The person signing in. They type their password only into the provider's page, not into the app.
Identity provider (IdP)
The trusted service that checks the user and returns a signed answer about them.
Relying application
Your app. It checks the provider's signed answer and decides whether to let the user in.
Why Does Handing Off Sign-in Help?
Delegation means passing a job to someone else. Here, the app passes sign-in to the provider. This removes the need to store passwords for those users. Fewer stored passwords means less to lose if the app's database leaks. Users also stop juggling many logins, because one trusted account can open several apps. That is single sign-on at work.
Offboarding, which means removing a person's access when they leave, also gets easier. If the company disables the person's account at the provider, that change covers every app that trusts the provider. Without federation, someone has to find and close the account in every app. Microsoft's pattern guidance warns that large organizations often miss this step.
How Does the Sign-in Flow Work?
The steps below give a high-level view. The details differ between protocols, but the order stays the same.
- 1
Start the request
The user clicks a sign-in button. The app builds a request that names itself and says where the provider should send the answer back.
- 2
Redirect to the provider
The app sends the user's browser to the provider's sign-in page. A redirect is an instruction that moves the browser to a different web address.
- 3
Authenticate at the provider
The user proves who they are on the provider's page, for example with a password and a second step. The app never sees the password.
- 4
Return a signed token
The provider sends the browser back to the app with a signed token. In OpenID Connect this is an ID token. In SAML it is an assertion.
- 5
Validate and use the claims
The app checks the token, reads claims such as email or roles, and then opens or creates the user's account. From here it runs its own session.
How Do You Read the Token Safely?
An OpenID Connect ID token is a JSON Web Token (JWT). JSON is a plain text format made of named fields, and a JWT is a signed package of claims in that format. The app must check each of these. A SAML assertion carries similar facts in XML form.
The sample below is a simplified checker. It checks the audience and the expiry time only. It skips the signature check, which a real app must do with a tested library or the provider's software kit.
# Simplified check: real apps must also verify the signature.
token_claims = {
'iss': 'https://idp.example.com',
'sub': 'user-4471',
'aud': 'notes-app',
'email': 'ana@example.com',
'exp': 1700000600,
}
my_app_id = 'notes-app'
now = 1700000000
if token_claims['aud'] != my_app_id:
print('reject: token is for another app')
elif token_claims['exp'] <= now:
print('reject: token has expired')
else:
print('accept:', token_claims['email'])
Output
accept: ana@example.com
Worked Example: A Continue With Google Button
Picture a notes app with a sign-in screen. It shows a button labeled 'Continue with Google'. The notes app is an invented example, but the same steps run behind many real login screens.
- 1
Click the button
The app redirects the browser to Google's sign-in page. The request names the notes app and asks for the user's email address.
- 2
Sign in at Google
The user types a Google password on Google's page. The notes app never receives that password.
- 3
Google sends a token back
The browser returns to the notes app with a signed token. It carries a verified email address and a user ID that does not change.
- 4
The app checks the token
The app confirms the signature, the audience, and the expiry time, as the code sample above shows.
- 5
The app opens the account
If no account matches that user ID, the app creates one. Then it starts its own session. The notes themselves are still stored by the notes app, not by Google.
Tip
Match returning users on the provider's user ID, not on a name the user typed. Some providers send only an email address, so save the user ID with the account the first time it appears.
Trade-offs to Weigh
Federation does not remove risk. It moves some risk to the provider and adds new work for your team.
Less password risk
Your app stores no passwords for federated users, so there is no password table to leak. You still have to check every token carefully.
Dependence on the provider
If the provider is down, your users cannot sign in. Microsoft's guidance calls authentication a possible single point of failure, which means one part whose failure stops everything, so plan for outages.
Claim mapping work
A role claim means nothing until you map it to your own permissions. Social providers may send only an email address, so your app still needs its own user records.
Token Expiry and Revocation
Every token has a limited life. The exp claim marks the moment the app must stop accepting it. Revocation means taking away access before it would end on its own. It is harder than it sounds. A user removed at the provider may keep access in your app until the app's session ends. You can plan for this with short token lives, regular checks, or provider messages that end sessions. Single logout is also uneven. One source notes that signing out of one app may leave other federated sessions open.
Tip
Decide before launch how a removed user loses access to your app, and test that path with a real test account.
When to Federate and When Local Accounts Are Enough
Use a simple test. Ask who will sign in, whether they already have a login they trust, and how many organizations are involved. Federation pays off when users already have accounts in another directory, which means a list of accounts run by an organization. Microsoft's guidance lists SSO, multi-partner sign-in, SaaS applications, and federated workload access as scenarios where the pattern applies.
Business customers
If a customer's staff must use the customer's own login, federate with that customer's provider. Business apps and partner apps are the classic case.
Social login
Offering Google or a similar sign-in cuts password forms for public users. The trade-off is reliance on that platform and thinner profile data.
A few known users
A small internal tool used by a handful of people may not need federation. A local account is simpler. Microsoft's guidance says the pattern may not suit an app where every user signs in through one directory.
Quick check
A startup sells its web app to a large company. The company's IT team insists that staff use their corporate logins, and that a person's access ends automatically when they leave. Which design fits, and who checks the employee's password?
Key Points to Remember
Federated Identity hands sign-in to a trusted identity provider. Your app does not store or check those passwords. It accepts a signed token, checks the signature, audience, and expiry, and then reads the claims it needs. Authentication says who the user is. Authorization decides what the user may do, and your app still owns that second job. Weigh the gains, such as less password risk and easier offboarding, against the cost of depending on the provider and mapping claims to permissions.
Quick check
Your app receives an ID token whose signature checks out. The aud claim names a different app's client ID. What should the app do?
Sources
- Federated Identity pattern, Azure Architecture Center (Microsoft Learn)
- OpenID Connect Core 1.0 incorporating errata set 2 (OpenID Foundation)
- OpenID Connect Core 1.0 draft 36 incorporating errata set 3 (OpenID Foundation)
- Architectural Approaches for Identity in Multitenant Solutions, Azure Architecture Center
- SAML versus OpenID Connect: Choose the right SSO protocol, Microsoft Entra ID
- Federated Identity vs. Single Sign-On: Key Differences, Auth0 blog
- What's the Difference Between OAuth, OpenID Connect, and SAML?, Okta
- What is federated identity and how does it work?, Safeguard.sh
- SAML vs OpenID Connect (OIDC): When to Use Each, Duende Software
Last updated on 18 November 2026
Related lessons
- UI/UX basicsPrime User-Relevant Associations: Show Cues That Match What Users Care About
- Design systemsA/B Tests & Experiments: Let Real User Data Pick Your Design System Standards
- System designPublisher/Subscriber: Announce Events Once and Let Many Services Listen
- System designHigh Availability: Keep Serving Users When Parts Fail
Learn with me
Every lesson is free. I add new ones as I learn. Have a question, or want help with your own work? Book a short call.