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 inCategory: 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
- Microservices Architecture Map — How an API gateway fans out to independent services, each with its own datastore, plus the async event bus wiring billing and notifications to order events.
- Role-Based Access Control Model — Users belong to teams and hold roles; roles bundle the permissions that actually gate an action — the object model behind most RBAC implementations.