Free online courseInteractive · No sign-up · Works offline once loaded

OAuth, OpenID Connect & SAML: single sign-on explained

How “Sign in with …” and company single sign-on really work, from the first redirect to the signed token, and where real attackers got in. With live PKCE, token checks, SAML decoding and DPoP in your browser.

  • Intermediate
  • 8 chapters
  • 29 interactive lessons
  • About 41 minutes
  • English
  • Updated November 2026
Start the course 29 lessons · about 41 min · free
Login and permission Lesson 1 of 29

Chapter 1: Login and permission

Lesson 1.1 · Login and permission

Who are you? What may you do?

Authentication answers “who are you?”. Authorization answers “what may you do?”.

OpenID Connect and SAML are about the first, OAuth 2.0 is about the second. Most confusion in this field starts right here.

Example 1

Lesson 1.2 · Login and permission

Sessions and bearer tokens

After the login, a browser app usually keeps a session cookie. APIs get an access token in the Authorization header.

Most access tokens are bearer tokens: whoever holds one can use it, like cash. No password, no second factor, no questions.

That’s why they expire after minutes or an hour, and why they never belong in logs or URLs.

GET /inbox HTTP/1.1
Host: mail.example
Cookie: session=7f3a9c1e…

GET /v1/photos HTTP/1.1
Host: api.photos.example
Authorization: Bearer eyJhbGciOiJFUzI1NiIs…
Quick check

An access token shows up in a shared log file. What can someone do with it?

Lesson 1.3 · Login and permission

Why single sign-on

With single sign-on, one identity provider (IdP) such as Microsoft Entra ID, Okta or Google answers “who are you?” for every app.

Users get one strong login with phishing-resistant MFA. Admins get one switch: disable the account and every connected app closes. With SCIM the IdP even creates and deletes the accounts inside the apps.

Try itLet Sam leave the company, once without and once with SSO.

  • Mailsam@corp
  • Wikisam@corp
  • CRMsam@corp
  • Gitsam@corp
  • HRsam@corp
  • Chatsam@corp
  • Cloudsam@corp

Sam leaves the company today.

Chapter 2: OAuth 2.0

Lesson 2.1 · OAuth 2.0

Four roles and a valet key

OAuth is like the valet key of a car: it starts the engine, but doesn’t open the trunk. An app gets limited access to your data, without your password.

Four roles take part. In our example, PhotoPrint wants to print pictures from your cloud storage.

Try itTap each role.

Tap a part

Four parties, one token.

Lesson 2.2 · OAuth 2.0

The authorization code flow, step by step

This is the flow every app with users should use. Follow the requests: the browser carries only a short-lived code.

The client swaps that code for tokens directly with the server, out of the browser’s sight.

  1. Browser goes to the authorization endpoint
    https://id.example/authorizeresponse_type = codeclient_id = photoprint-webredirect_uri = https://photoprint.example/callbackscope = openid profile emailstate = af0ifjsldkjnonce = n-0S6_WzA2Mjcode_challenge = E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cMcode_challenge_method = S256
  2. You sign in and agree to the scopes
    With passkey or MFA at id.example. PhotoPrint sees nothing of this.
  3. Back to the app with a code
    https://photoprint.example/callbackcode = SplxlOBeZQQYbYS6WxSbIAstate = af0ifjsldkjThe app checks that state is the value it sent.
  4. Server to server: code for tokens
    POST https://id.example/token
    grant_type=authorization_code&code=SplxlOBe…&redirect_uri=…&code_verifier=dBjftJeZ4CVP…
  5. Tokens arrive
    { "access_token": "eyJ…", "token_type": "Bearer", "expires_in": 3600, "refresh_token": "8xLOxBtZ…", "id_token": "eyJ…" }
Lesson 2.3 · OAuth 2.0

Ask for as little as possible

You build a small desk display that shows your next meeting. Which permissions (scopes) does it need?

Every extra scope is extra damage when a token leaks, and an extra line on the consent screen that makes people hesitate.

Example 1

Chapter 3: PKCE, tokens and OAuth 2.1

Lesson 3.1 · PKCE, tokens and OAuth 2.1

PKCE: proof that you started the flow

The code passes through the browser, and codes can leak: from logs, history or a malicious app on the phone.

PKCE ties the code to the client that asked for it. The client keeps a random code_verifier and sends only its SHA-256 hash, the code_challenge. To redeem the code it must show the verifier.

RFC 9700 recommends PKCE for every client.

Try itMake a verifier, then let an attacker redeem a stolen code.

code_verifier stays in the client
dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk
code_challenge = BASE64URL(SHA-256(verifier)) goes to /authorize
E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM

Computed in your browser. Generate your own pair with the PKCE generator.

Lesson 3.2 · PKCE, tokens and OAuth 2.1

Redirect URIs: exact match only

The authorization server sends the code to the redirect_uri. If it accepts a slightly different address, the code can land with an attacker.

RFC 9700 is clear: compare redirect URIs exactly, as strings. Registered here: https://photoprint.example/callback

Example 1

Lesson 3.3 · PKCE, tokens and OAuth 2.1

Refresh tokens and rotation

Access tokens should live minutes, not days. To stay signed in, the client uses a refresh token.

With rotation, every refresh returns a new refresh token and burns the old one. If a burnt one shows up again, someone stole it, and the server revokes the whole chain.

Try itLet time pass, refresh, then let a thief replay an old refresh token.

Access tokenAT-1
Refresh tokenRT-1
    Lesson 3.4 · PKCE, tokens and OAuth 2.1

    Machines, TVs and device-code phishing

    Not every client has a user with a browser. Server-to-server jobs use client credentials, ideally with a certificate instead of a secret.

    TVs and command-line tools use the device code flow (RFC 8628): the device shows a code, you enter it on your phone. Attackers abuse exactly that. In February 2025 Microsoft described Storm-2372 sending fake Teams invitations with such a code.

    Smart TV

    To sign in, open id.example/device and enter

    WDJB-MJHT
    Spot the trap

    An email invites you to a meeting: “To join, enter code WDJB-MJHT at id.example/device.” The page is real. What happens if you do?

    Chapter 4: OpenID Connect

    Lesson 4.1 · OpenID Connect

    The ID token: a signed note about you

    OAuth alone says nothing about who signed in. OpenID Connect adds it: ask for the scope openid and you get an ID token.

    It is a JWT: header, payload and signature, Base64url-encoded and separated by dots. The payload holds claims about the login.

    Try itTap each claim.

    eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImstMjAyNi0xMSJ9.eyJpc3MiOiJodHRwczovL2lkLmV4YW1wbGUiLCJzdWIiOiIyNDgyODk3NjEwMDEiLCJhdWQiOiJwaG90b3ByaW50LXdlYiIsImV4cCI6MTkyNDk5MjAwMCwiaWF0IjoxOTI0OTg4NDAwLCJub25jZSI6Im4tMFM2X1d6QTJNaiIsIm5hbWUiOiJKYW5lIERvZSIsImVtYWlsIjoiamFuZUBtYWlsLmV4YW1wbGUiLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZX0.KcF6w7lkm6nX1pJo9k3EmOKvlzju7bwBiJaxKoIqw3EaJQclcQldrO7fai5xf7KnWwFg3sHDOpHn-q_YqaT7sA

    Tap a part

    Real ES256 token, signed by the build of this page.

    Lesson 4.2 · OpenID Connect

    Checking an ID token

    Before a client trusts an ID token, it checks five things: the signature with the provider’s public key, the issuer, the audience, the expiry and the nonce.

    Here the checks run for real: ES256 verification in your browser.

    Try itBreak the token in different ways and run the checks.

      Lesson 4.3 · OpenID Connect

      Discovery and JWKS

      Where are the endpoints and keys? Every OpenID provider publishes a discovery document at /.well-known/openid-configuration.

      Libraries read it once and know everything: where to send the browser, where to swap codes, where to fetch the signing keys.

      Try itTap the fields of the discovery document.

      Tap a part

      GET https://id.example/.well-known/openid-configuration

      Lesson 4.4 · OpenID Connect

      Fine or a mistake?

      Most OIDC breaches aren’t broken crypto. They’re skipped checks and wrong assumptions in the app.

      Seven decisions from real code reviews. Fine or a mistake?

      Example 1

      Chapter 5: SAML 2.0

      Lesson 5.1 · SAML 2.0

      A SAML login, step by step

      In SAML the app is the service provider (SP), the company login is the identity provider (IdP). They never talk to each other directly.

      Every message travels through your browser: a redirect there, a form post back.

      1. You open the wiki
        wiki.example sees no session cookie and doesn’t know you yet.
      2. Redirect to the IdP with an AuthnRequest
        https://id.example/saml/ssoSAMLRequest = fZBBSwMxEIX/Sph7N9kUKx02…RelayState = /pages/42
      3. The IdP signs you in
        Passkey or MFA, plus company rules such as Conditional Access. The wiki sees none of this.
      4. A form posts the SAMLResponse back
        <form method="post" action="https://wiki.example/saml/acs">
        <input name="SAMLResponse" value="PHNhbWxwOlJlc3BvbnNl…">
        <input name="RelayState" value="/pages/42">
      5. The wiki checks and lets you in
        Signature, issuer, audience, time window, InResponseTo. Then its own session cookie, and you land on /pages/42.
      Lesson 5.2 · SAML 2.0

      Unpacking a SAMLRequest

      The SAMLRequest in the address bar looks like noise. It’s three layers of encoding, no encryption: URL encoding, Base64 and DEFLATE compression.

      Peel them off one by one. This is how you debug a failing SSO setup.

      Try itUnpack the request in three steps.

      Address bar https://id.example/saml/sso?SAMLRequest=fZBBSwMxEIX%2FSph7N9kUKx02C0u9LNRLaz14kRBGGtwkayap%2FfnSilBBvL3hvW9meB3bMM041HKMO%2FqoxEWcwxQZr4aBmiMmy54x2kCMxeF%2BeNyibhTOOZXk0gQ3yP%2BEZaZcfIogxgcDr%2Fb%2BbelaEM%2BU2adoQDcKxMhcaYxcbCwGtNKrRdsu9N2TWqNSqNQLiOFn0yZFroHynvLJOzrstgaOpcyMUn76d9%2FQ2YZ5Inn5TlrH0HcXidcruf8r28nbxPf0u6T%2BCw%3D%3D&RelayState=%2Fpages%2F42
      …

      Computed in your browser. Try the single steps with the Base64 tool.

      Lesson 5.3 · SAML 2.0

      Inside a SAML assertion

      The answer comes back as a signed assertion: an XML statement by the IdP about you.

      Each part has a job, and the app must check each one before it creates a session.

      Try itTap each part of the assertion.

      Tap a part

      Lesson 5.4 · SAML 2.0

      Signature wrapping

      An attacker has one validly signed response for his own account. He adds a second, unsigned assertion for the admin.

      The signature still checks out. The question is which assertion the app reads afterwards. In 2025 this broke ruby-saml: two XML parsers in one library saw different documents.

      Try itCompare how the two apps read the same response.

      <samlp:Response>
        <saml:Assertion ID="_x1">   NameID: admin@corp.example   (added, unsigned)
        <saml:Assertion ID="_9e1f"> NameID: mallory@corp.example <ds:Signature Reference="#_9e1f"/>
      </samlp:Response>

      Pick an app.

      Lesson 5.5 · SAML 2.0

      Certificates and Golden SAML

      Apps trust the IdP because they know its signing certificate from the metadata. Certificates expire; in Microsoft Entra ID a SAML signing certificate is valid for three years by default. Plan the change before then, or every login breaks on the same day.

      The private key behind it is the most valuable secret of the whole setup.

      IdP signing certificateCN=id.example SAML Signingvalid 2026-11-25 → 2029-11-25 · RSA 2048 · SHA-256
      Think like an attacker

      An attacker copies the private key of this certificate from the IdP server. What can he do?

      Look inside a certificate with the certificate decoder.

      Chapter 6: Microsoft Entra ID

      Lesson 6.1 · Microsoft Entra ID

      Tenant, app registration, enterprise app

      Microsoft Entra ID, until 2023 Azure Active Directory, is the identity provider behind Microsoft 365, and in many companies behind everything else too.

      It speaks OpenID Connect, OAuth 2.0 and SAML. Five terms explain most of the admin center.

      Try itTap each building block.

      Tap a part

      One directory, many apps.

      Lesson 6.2 · Microsoft Entra ID

      Endpoints and claims in Entra ID

      Entra’s endpoints all follow one pattern; {tenant} is your tenant ID or domain, or organizations and common for multi-tenant apps.

      The tokens carry a few Microsoft-specific claims. Which one identifies the user?

      Try itTap the claims.

      https://login.microsoftonline.com/{tenant}
        /oauth2/v2.0/authorize
        /oauth2/v2.0/token
        /v2.0/.well-known/openid-configuration
      Tap a part

      Part of an Entra ID token

      Lesson 6.3 · Microsoft Entra ID

      Conditional Access: authentication strength

      “Require MFA” lets every second factor through, including SMS. An authentication strength in Conditional Access says exactly which methods count.

      Entra has three built in. Pick one for the admin portals and look at the last column: what could an AiTM phishing site still relay?

      Try itPick a strength and see which methods still get in.

      MethodAllowed?Relayable by AiTM?
      Password + SMS code–yes
      Password + Authenticator push with number–yes
      Authenticator phone sign-in, no password–yes
      Passkey or FIDO2 security key–no
      Windows Hello for Business–no
      Certificate-based authentication (multifactor)–no

      Chapter 7: Real attacks and hardening

      Lesson 7.1 · Real attacks and hardening

      Six incidents, six lessons

      None of these attacks broke a cipher. They stole keys, abused permissions or slipped through a check that wasn’t made.

      Each one teaches one rule.

      Try itTap each incident.

      Tap a part

      From signing keys to device codes.

      Lesson 7.2 · Real attacks and hardening

      DPoP: tokens that only work with a key

      A bearer token works for whoever holds it. With DPoP (RFC 9449), the token is bound to a key pair of the client.

      For every request the client signs a short proof: method, URL, time and the token’s hash. A thief with the token but without the private key gets nowhere.

      Try itSteal the token in both modes and replay it.

      Access token
      …

        Real P-256 keys and ES256 signatures, made in your browser.

        Lesson 7.3 · Real attacks and hardening

        Your hardening checklist

        Eight measures stop or limit every incident from this chapter.

        Tick what’s already in place and see which attacks would have hit a wall.

        Try itTick what your organisation already does.

          Chapter 8: Choosing a protocol and final check

          Lesson 8.1 · Choosing a protocol and final check

          Which protocol for which job?

          There is no single best protocol. It depends on who signs in and who connects to whom.

          Three questions give you a starting point.

          What are you building?
          Who signs in?
          Do accounts have to appear and disappear automatically?

          Answer the questions to see a suggestion.

          Lesson 8.2 · Choosing a protocol and final check

          The passwords that remain

          Even with perfect single sign-on, a few secrets remain. They need their own place, not a spreadsheet:

          • Emergency access accounts: at least two cloud-only accounts for the day the IdP or MFA fails, with FIDO2 keys in a safe. Every sign-in raises an alert.
          • Service secrets: API keys of services without a managed identity. In a secrets vault, rotated, never in code.
          • Tools without SSO: shared logins go into a team password manager, which logs access and takes them away when someone leaves.
          Quick check

          Which account should be excluded from your normal Conditional Access policies?

          Team password managers: Bitwarden · 1Password · Proton Pass · NordPass · all compared

          Lesson 8.3 · Choosing a protocol and final check

          Ready for the next SSO project?

          Ten questions on everything in this course. Try as often as you like.

          Question 1 of 100 correct

          Course complete

          Almost there

          You have seen 0 of 29 lessons.

          Put your name on the certificate, then print it or save it as a PDF. Your name stays in this browser.

          encode-decode Academy

          Certificate of completion

          Your name

          has completed the free online course

          OAuth, OpenID Connect & SAML: single sign-on explained

          8 chapters · 29 interactive lessons · about 41 minutes

          encode-decode.com/academy/oauth-sso/

          Course notes

          The course as text

          Everything from the lessons in 8 short chapters, to read or to look something up later.

          Chapter 1

          Login and permission

          Two questions are easy to mix up. Authentication asks: who are you? Authorization asks: what may you do? OpenID Connect and SAML answer the first; OAuth 2.0 answers the second. Single sign-on (SSO) means one identity provider (IdP), for example Microsoft Entra ID, Okta or Google, answers “who are you?” for many applications.

          After a login, applications remember you with a session (a cookie in the browser) or with tokens. An OAuth access token is usually a bearer token (RFC 6750): whoever holds it can use it, like cash. That is why tokens are short-lived, travel only over TLS and never belong in logs or URLs.

          For companies, SSO is above all about control. When someone joins, moves or leaves, one change in the IdP opens or closes every connected application. With SCIM (RFC 7643/7644) the IdP can even create and delete the user accounts in those applications automatically.

          Open the lessons of chapter 1 →
          Chapter 2

          OAuth 2.0

          OAuth 2.0 (RFC 6749, 2012) lets an application act on your behalf without ever seeing your password. Four roles: the resource owner (you), the client (the app that wants access), the authorization server (where you sign in and agree) and the resource server (the API with your data). What the client may do is expressed as scopes, and you see them on the consent screen.

          The flow for apps with users is the authorization code flow. The client sends your browser to the authorization endpoint with its client_id, a redirect_uri, the scopes, a random state and, today always, a PKCE code_challenge. You sign in and agree. The authorization server sends the browser back to the redirect_uri with a short-lived code. The client exchanges that code at the token endpoint, server to server, for an access token and usually a refresh token. Tokens never travel through the address bar.

          Ask for as little as possible: a desk display that shows your next meeting needs read access to the calendar, not to your mail or files. Fewer scopes mean less damage when a token leaks, and a consent screen that people actually understand.

          Open the lessons of chapter 2 →
          Chapter 3

          PKCE, tokens and OAuth 2.1

          PKCE (RFC 7636, “pixy”) protects the code on its way through the browser. The client makes a random code_verifier (43 to 128 characters), sends only its SHA-256 hash as code_challenge with the first request, and presents the verifier when it redeems the code. Whoever steals the code from a redirect, a log or a malicious app doesn't have the verifier and gets nothing. The OAuth security best practice (RFC 9700, January 2025) recommends PKCE for all clients, and the upcoming OAuth 2.1, still an IETF draft in late 2026, makes it mandatory.

          RFC 9700 also says: compare redirect URIs exactly, as strings, and drop the implicit flow and the password grant. Pattern matching on redirect URIs has led to many token leaks: a trailing slash, an extra subdomain or an open redirect parameter is enough.

          Access tokens should be short-lived. To stay signed in, clients use a refresh token. With refresh token rotation, every refresh returns a new refresh token and invalidates the old one; if an old one is ever used again, the server assumes theft and revokes the whole chain. For machines without users, the client credentials grant uses the client's own identity, ideally a certificate or workload identity rather than a secret. Devices without a keyboard use the device authorization grant (RFC 8628): the TV shows a code that you enter on your phone. Attackers abuse exactly that: in February 2025 Microsoft described the group Storm-2372 sending fake Teams invitations with a device code; whoever entered it signed the attacker's device in. Block the device code flow where you don't need it.

          Open the lessons of chapter 3 →
          Chapter 4

          OpenID Connect

          OAuth alone says nothing about who signed in. OpenID Connect (OIDC, 2014, ISO/IEC 26131 since 2024) adds that layer: request the scope openid and you receive an ID token next to the access token. The ID token is a signed JWT for the client, not for an API: iss names the identity provider, sub the user (unique per issuer), aud the client it was issued to, exp and iat the validity, and nonce ties it to the login the client started.

          Before trusting an ID token, the client checks (OIDC Core 3.1.3.7): the signature with a key from the provider's JWKS, the issuer, the audience (its own client_id), the expiry and the nonce. Where are the keys? In the discovery document at /.well-known/openid-configuration, which lists the endpoints and the jwks_uri. Keys rotate; the kid in the token header says which one signed. Use a maintained library for all of this; don't parse tokens by hand.

          Typical mistakes: accepting any validly signed token without checking aud (so a token for another app works too), allowing alg: none, identifying users by their email address, which can change, instead of iss + sub, and writing tokens into logs. Decode and check tokens of your own with the JWT decoder.

          Open the lessons of chapter 4 →
          Chapter 5

          SAML 2.0

          SAML 2.0 (OASIS, 2005) is the older single sign-on standard and still the most common one in companies: HR systems, wikis, VPNs and almost every enterprise SaaS speak it. The service provider (SP, the app) and the identity provider (IdP) exchange XML messages through the browser. In the usual SP-initiated flow, the app sends an AuthnRequest to the IdP via the HTTP-Redirect binding (compressed with DEFLATE, Base64-encoded, put in the URL as SAMLRequest). The IdP signs you in and returns a signed Response with an assertion, posted by an auto-submitting form to the app's Assertion Consumer Service (ACS) URL.

          The SP must check: the XML signature with the IdP's certificate from the metadata, the issuer, the audience (its own entity ID), the time window (NotBefore/NotOnOrAfter), the recipient (its ACS URL), InResponseTo (matches its request) and that the assertion is used only once. Signature checks in XML are hard to get right. In signature wrapping attacks, an attacker moves the signed element and adds an unsigned one that the application then reads. In March 2025 GitHub Security Lab published two such bypasses in the widely used ruby-saml library (CVE-2025-25291 and CVE-2025-25292, fixed in 1.12.4 and 1.18.0): two XML parsers in the same library saw different documents, so “signature valid” and “this is the user” referred to different elements.

          The IdP's token-signing key is the key to every connected app. Whoever steals it can forge assertions for any user, without password or MFA: CyberArk named this Golden SAML in 2017, and the SolarWinds attackers used it in 2020 against on-premises AD FS servers. Keep signing keys in hardware or in a cloud IdP, watch certificate changes, and plan the rollover before a certificate expires.

          Open the lessons of chapter 5 →
          Chapter 6

          Microsoft Entra ID

          Microsoft Entra ID (until 2023 Azure Active Directory) is the identity provider behind Microsoft 365 and Azure, and for many companies behind everything else too. It speaks OpenID Connect, OAuth 2.0 and SAML. A tenant is one organisation's directory with a tenant ID. An app registration defines an application once (application object, client ID, redirect URIs, certificates and secrets, the API permissions it asks for); an enterprise application is its service principal, the instance in a specific tenant where users are assigned, consent is recorded and SAML or Conditional Access is configured. A multi-tenant app has one app registration and a service principal in every customer tenant.

          The endpoints follow one pattern: https://login.microsoftonline.com/{tenant}/oauth2/v2.0/authorize and …/token, discovery at …/{tenant}/v2.0/.well-known/openid-configuration. Tokens carry tid (tenant), oid (the user's object ID, the same for all apps in the tenant), sub (different for each app), preferred_username (for display only), roles (app roles) and groups. Identify users by tid + oid, never by email: in 2023 the “nOAuth” research by Descope showed that multi-tenant apps matching users by the mutable, unverified email claim could be taken over. Above 200 groups (JWT) or 150 groups (SAML), Entra sends an overage indicator instead of the list, and the app must ask Microsoft Graph.

          Conditional Access decides after the first sign-in whether and how access is granted: by user, app, device, location and risk. With authentication strengths a policy can require specific methods; the built-in ones are “Multifactor authentication strength”, “Passwordless MFA strength” and “Phishing-resistant MFA strength” (FIDO2 security keys and passkeys, Windows Hello for Business or platform credential, certificate-based authentication). For admins Microsoft recommends the phishing-resistant strength. Consent decides which permissions apps receive. Since a rollout between mid-July and August 2025, the Microsoft-managed default policy no longer lets users consent to third-party apps reading all files or sites (Files.Read.All, Files.ReadWrite.All, Sites.Read.All, Sites.ReadWrite.All); application permissions always require an admin. Look at your enterprise applications regularly: which ones have which permissions, and does anyone still need them?

          Open the lessons of chapter 6 →
          Chapter 7

          Real attacks and hardening

          Most large identity incidents of recent years did not break any cryptography. They abused keys, permissions and validation gaps. In Storm-0558 (2023), a China-based group used a stolen Microsoft consumer signing key from 2016 and a flaw in token validation to forge tokens for Exchange Online; the US Cyber Safety Review Board counted 22 affected organisations and more than 500 people and called the intrusion preventable. In Midnight Blizzard (disclosed January 2024), Russian attackers password-sprayed a legacy test tenant account without MFA, took over an old test OAuth app with high privileges and granted themselves the Exchange Online role full_access_as_app to read Microsoft executives' mailboxes. In Storm-2372 (since August 2024, published February 2025) device codes went out in fake Teams invitations; in April 2026 Microsoft described a campaign that generates the code only at the moment of the click, to get round the 15-minute lifetime.

          Sender-constrained tokens limit the damage of stolen tokens. With DPoP (RFC 9449, 2023), the client holds a key pair and signs a short proof for every request: method, URL, time, a unique ID and the hash of the token. The authorization server binds the token to the key's thumbprint (RFC 7638) in the cnf.jkt claim. A thief with the token but without the private key gets nothing. Mutual TLS (RFC 8705) does the same with client certificates.

          The hardening list is short: phishing-resistant MFA for every account that can sign in, test tenants included; block flows you don't use (device code, legacy authentication); only admins consent to apps, and someone reviews app permissions; exact redirect URIs and PKCE; validate tokens with maintained libraries and identify users by stable IDs; keep SAML and OIDC libraries current; protect and monitor signing keys; short token lifetimes, refresh-token rotation and sender-constrained tokens where available.

          Open the lessons of chapter 7 →
          Chapter 8

          Choosing a protocol and final check

          For new applications with users, use OpenID Connect with the authorization code flow and PKCE; for API access, OAuth 2.0. If you sell software to companies, also offer SAML, because many customers' identity teams still connect everything that way, and add SCIM so accounts are created and removed automatically. For machine-to-machine access, use client credentials with certificates or, better, managed identities and workload identity federation, which need no stored secret at all. Old on-premises applications that speak only Kerberos or LDAP can often be published through a proxy such as Microsoft Entra application proxy, so they still get modern sign-in and Conditional Access.

          A few passwords remain even with perfect SSO: emergency access accounts (break-glass), which Microsoft recommends keeping as at least two cloud-only accounts with phishing-resistant methods such as FIDO2 keys, excluded from normal Conditional Access policies but closely monitored; secrets for services that can't use managed identities yet; and shared logins of tools without SSO. A team password manager with shared vaults, access logs and secure sharing is the right place for those. Deeper into the building blocks: the Account security course explains passkeys and 2FA from the user's side; the JWT decoder and the PKCE generator let you look at real tokens and challenges.

          Open the lessons of chapter 8 →
          Glossary

          Words you will meet

          Access token
          Lets a client call an API. Usually a bearer token, short-lived.
          Assertion (SAML)
          A signed XML statement by the IdP: who the user is, until when, for which app.
          Audience (aud)
          The client or API a token was issued for. Anyone else must reject it.
          Authorization code
          A short-lived code in the redirect that the client swaps for tokens.
          Conditional Access
          Rules in Microsoft Entra ID that decide at sign-in whether and how access is granted.
          Consent
          Agreeing that an app may use certain permissions (scopes).
          Device code flow
          Sign-in for devices without a keyboard: a code is entered on another device.
          DPoP
          Binds a token to a key pair of the client; every request carries a signed proof.
          Enterprise application
          The service principal of an app in an Entra ID tenant.
          ID token
          A signed JWT from OpenID Connect that tells the client who signed in.
          IdP
          Identity provider: the service where users sign in, e.g. Entra ID, Okta, Google.
          JWKS
          JSON Web Key Set: the public keys an IdP signs tokens with.
          PKCE
          Proof Key for Code Exchange: ties the authorization code to the client that asked for it.
          Refresh token
          Gets new access tokens without a new login. Rotated with every use.
          SCIM
          Standard for creating and deleting user accounts in apps automatically.
          Scope
          A permission an app asks for, e.g. Calendars.Read.
          Service provider (SP)
          In SAML: the application that relies on the IdP.

          Searches the list of pages on this site. What you type stays in your browser.