|
| 1 | +# 🚀 Client Usage Guide |
| 2 | + |
| 3 | +UltimateAuth Client is a **high-level SDK** designed to simplify authentication flows. |
| 4 | + |
| 5 | +It is NOT just an HTTP wrapper. |
| 6 | + |
| 7 | +## 🧠 What Makes the Client Different? |
| 8 | + |
| 9 | +The client: |
| 10 | + |
| 11 | +- Handles full authentication flows (login, PKCE, refresh) |
| 12 | +- Manages redirects automatically |
| 13 | +- Publishes state events |
| 14 | +- Provides structured results |
| 15 | +- Works across multiple client types (SPA, server, hybrid) |
| 16 | + |
| 17 | +👉 You SHOULD use the client instead of calling endpoints manually. |
| 18 | + |
| 19 | +<br> |
| 20 | + |
| 21 | +## 🧱 Client Architecture |
| 22 | + |
| 23 | +The client is split into multiple specialized services: |
| 24 | + |
| 25 | +| Service | Responsibility | |
| 26 | +|----------------------|-------------------------------------| |
| 27 | +| FlowClient | Login, logout, refresh, PKCE | |
| 28 | +| SessionClient | Session & device management | |
| 29 | +| UserClient | User profile & lifecycle | |
| 30 | +| IdentifierClient | Email / username / phone management | |
| 31 | +| CredentialClient | Password management | |
| 32 | +| AuthorizationClient | Roles & permissions | |
| 33 | + |
| 34 | +<br> |
| 35 | + |
| 36 | +## 🔑 Core Concept: Flow-Based Design |
| 37 | + |
| 38 | +UltimateAuth is **flow-oriented**, not endpoint-oriented. |
| 39 | + |
| 40 | +Instead of calling endpoints: |
| 41 | + |
| 42 | +❌ POST /auth/login |
| 43 | +✔ flowClient.LoginAsync() |
| 44 | + |
| 45 | +<br> |
| 46 | + |
| 47 | +## ⚡ Example |
| 48 | + |
| 49 | +```csharp |
| 50 | +await flowClient.LoginAsync(new LoginRequest |
| 51 | +{ |
| 52 | + Identifier = "user@ultimateauth.com", |
| 53 | + Secret = "password" |
| 54 | +}); |
| 55 | +``` |
| 56 | + |
| 57 | +👉 This automatically: |
| 58 | + |
| 59 | +- Builds request payload |
| 60 | +- Handles redirect |
| 61 | +- Integrates with configured endpoints |
| 62 | + |
| 63 | +<br> |
| 64 | + |
| 65 | +## 🔄 State Events |
| 66 | + |
| 67 | +Client automatically publishes events: |
| 68 | + |
| 69 | +- SessionRevoked |
| 70 | +- ProfileChanged |
| 71 | +- AuthorizationChanged |
| 72 | + |
| 73 | +<br> |
| 74 | + |
| 75 | +## 🧭 How to Use This Section |
| 76 | + |
| 77 | +Follow these guides: |
| 78 | + |
| 79 | +- authentication.md → login, refresh, logout |
| 80 | +- session-management.md → sessions & devices |
| 81 | +- user-management.md → user operations |
| 82 | +- identifiers.md → login identifiers |
| 83 | +- authorization.md → roles & permissions |
| 84 | + |
| 85 | +## 🎯 Summary |
| 86 | + |
| 87 | +UltimateAuth Client: |
| 88 | + |
| 89 | +- abstracts complexity |
| 90 | +- enforces correct flows |
| 91 | +- reduces security mistakes |
| 92 | + |
| 93 | + |
| 94 | +👉 Think of it as: |
| 95 | + |
| 96 | +**“Authentication runtime for your frontend / app”** |
0 commit comments