|
| 1 | +# 🧩 Client Options |
| 2 | + |
| 3 | +Client Options define how UltimateAuth behaves on the **client side**. |
| 4 | + |
| 5 | +👉 While Server controls the system, |
| 6 | +👉 Client controls how it is **used** |
| 7 | + |
| 8 | +## 🧠 What Are Client Options? |
| 9 | + |
| 10 | +Client options configure: |
| 11 | + |
| 12 | +- Client profile (WASM, Server, MAUI, API) |
| 13 | +- Endpoint communication |
| 14 | +- PKCE behavior |
| 15 | +- Token refresh |
| 16 | +- Re-authentication behavior |
| 17 | + |
| 18 | +<br> |
| 19 | + |
| 20 | +## ⚙️ Basic Usage |
| 21 | + |
| 22 | +```csharp |
| 23 | +builder.Services.AddUltimateAuthClientBlazor(o => |
| 24 | +{ |
| 25 | + o.AutoDetectClientProfile = false; |
| 26 | +}); |
| 27 | +``` |
| 28 | + |
| 29 | +<br> |
| 30 | + |
| 31 | +## 🧩 Client Profile |
| 32 | + |
| 33 | +UltimateAuth automatically detects client type by default: |
| 34 | + |
| 35 | +- Blazor WASM |
| 36 | +- Blazor Server |
| 37 | +- MAUI |
| 38 | +- WebServer |
| 39 | +- API |
| 40 | + |
| 41 | +You can override manually: |
| 42 | + |
| 43 | +```csharp |
| 44 | +o.ClientProfile = UAuthClientProfile.BlazorWasm; |
| 45 | +``` |
| 46 | + |
| 47 | +👉 Manual override is useful for testing or special scenarios |
| 48 | + |
| 49 | +<br> |
| 50 | + |
| 51 | +## 🌐 Endpoints |
| 52 | + |
| 53 | +Defines where requests are sent: |
| 54 | + |
| 55 | +```csharp |
| 56 | +o.Endpoints.BasePath = "https://localhost:5001/auth"; |
| 57 | +``` |
| 58 | + |
| 59 | +👉 Required for WASM / remote clients |
| 60 | + |
| 61 | +<br> |
| 62 | + |
| 63 | +## 🔐 PKCE Configuration |
| 64 | + |
| 65 | +Used for browser-based login flows: |
| 66 | + |
| 67 | +```csharp |
| 68 | +o.Pkce.ReturnUrl = "https://localhost:5002/home"; |
| 69 | +``` |
| 70 | + |
| 71 | +👉 Required for WASM scenarios |
| 72 | + |
| 73 | +<br> |
| 74 | + |
| 75 | +## 🔁 Auto Refresh |
| 76 | + |
| 77 | +Controls token/session refresh behavior: |
| 78 | + |
| 79 | +```csharp |
| 80 | +o.AutoRefresh.Interval = TimeSpan.FromMinutes(1); |
| 81 | +``` |
| 82 | + |
| 83 | +👉 Keeps authentication alive automatically |
| 84 | + |
| 85 | +<br> |
| 86 | + |
| 87 | +## 🔄 Re-authentication |
| 88 | + |
| 89 | +Controls behavior when session expires: |
| 90 | + |
| 91 | +```csharp |
| 92 | +o.Reauth.Behavior = ReauthBehavior.RaiseEvent; |
| 93 | +``` |
| 94 | + |
| 95 | +👉 Allows silent or interactive re-login |
| 96 | + |
| 97 | +<br> |
| 98 | + |
| 99 | +## 🧠 Mental Model |
| 100 | + |
| 101 | +If you remember one thing: |
| 102 | + |
| 103 | +👉 Server decides |
| 104 | +👉 Client adapts |
| 105 | + |
| 106 | +## 📌 Key Takeaways |
| 107 | + |
| 108 | +- Client options control runtime behavior |
| 109 | +- Profile detection is automatic |
| 110 | +- PKCE is required for public clients |
| 111 | +- Refresh and re-auth are configurable |
| 112 | +- Works together with Server options |
| 113 | + |
| 114 | +--- |
| 115 | + |
| 116 | +## ➡️ Next Step |
| 117 | + |
| 118 | +Continue to **Configuration Sources** |
0 commit comments