Mermaid StudioEditor

OAuth Login Flow

The authorization-code exchange between a browser, your app, and an identity provider.

Mermaid source
sequenceDiagram
    participant U as User
    participant A as App
    participant I as Identity Provider
    U->>A: Click "Sign in"
    A->>I: Redirect with client_id
    I->>U: Prompt for credentials
    U->>I: Submit credentials
    I->>A: Redirect with auth code
    A->>I: Exchange code for token
    I-->>A: Access token
    A-->>U: Signed in
OAuth Login FlowOpen in editor →

Category: Architecture · Tags: auth, oauth, sequence

How to use this template

Choose Open in editor under the diagram to load this template into Mermaid Studio. Rename the boxes and arrows to match your own system, either in the code or on the visual canvas, then export it as PNG, SVG or JPEG, or copy the Mermaid code into a Markdown file. GitHub, GitLab, Notion and Obsidian all render Mermaid code blocks.

The Mermaid Sequence Diagram Syntax reference explains every construct this template uses, and the Sequence Diagram Generator page has more examples.

Related templates