FlowDiagram
Security & identityMermaid

OAuth 2.0 login with PKCE template

The authorization-code-with-PKCE flow a single-page or mobile app uses to sign a user in without a client secret — the standard picture for any SSO integration review. This architecture diagram template contains 18 labelled components, branches such as “No”, “Yes”.

Open in the editor →
  • Free — no account, no trial, no watermark
  • Fully editable shapes and connectors, not a screenshot
  • Export PNG, SVG or PDF, or share it as a link
  • Private: the diagram never leaves your browser

Components in this architecture diagram

  • User clicks Sign in
  • App creates code verifier & challenge
  • Redirect to identity provider /authorize
  • Existing session at IdP?
  • User enters credentials
  • MFA required?
  • MFA challenge: app, SMS or passkey
  • MFA passed?
  • Access denied
  • Consent screen
  • User consents?
  • Redirect back with authorization code
  • App exchanges code + verifier for tokens
  • Verifier matches challenge?
  • Access token & refresh token issued
  • Validate ID token signature & claims
  • Create app session
  • Signed in

How to use this architecture diagram template

  1. Click Open in the editor. The architecture diagram opens on a new page in FlowDiagram — nothing is uploaded and there is no sign-up.
  2. Rename, add or delete shapes and drag them where you want; connectors stay attached as things move.
  3. Drop in vendor logos from the library — 1,160 of them, including every AWS, Azure and Google Cloud service icon — or restyle it with the colour and theme controls.
  4. Prefer text? Edit the Mermaid source below and paste it in through ☰ → Import diagram (see the Mermaid editor); it imports as an editable diagram.
  5. Export to PNG, SVG or PDF, or press Ctrl+L for a link that carries the whole diagram.

Mermaid source

The whole template is the text below. Paste it into FlowDiagram, keep it in Git next to the code it describes, or hand it to an AI assistant to extend.

flowchart TD
  A((User clicks Sign in)) --> B[App creates code verifier & challenge]
  B --> C[Redirect to identity provider /authorize]
  C --> D{Existing session at IdP?}
  D -->|No| E[User enters credentials]
  E --> F{MFA required?}
  F -->|Yes| G[MFA challenge: app, SMS or passkey]
  G --> H{MFA passed?}
  H -->|No| I((Access denied))
  H -->|Yes| J[Consent screen]
  F -->|No| J
  D -->|Yes| J
  J --> K{User consents?}
  K -->|No| I
  K -->|Yes| L[Redirect back with authorization code]
  L --> M[App exchanges code + verifier for tokens]
  M --> N{Verifier matches challenge?}
  N -->|No| I
  N -->|Yes| O[Access token & refresh token issued]
  O --> P[Validate ID token signature & claims]
  P --> Q[Create app session]
  Q --> R((Signed in))

Related: System architecture diagram tool · Mermaid editor · All security & identity templates · All 521 templates