You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: AGENTS.md
+37Lines changed: 37 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -143,6 +143,43 @@ This SDK uses **Universal Login** for MFA step-up flows. When an MFA-required er
143
143
144
144
See [Auth0.swift documentation](https://github.com/auth0/Auth0.swift) for detailed setup.
145
145
146
+
## MyAccount API Client — Required Pattern
147
+
148
+
**All My Account API calls MUST use `MyAccountClientFactory.create()` instead of calling `Auth0.myAccount()` directly.**
149
+
150
+
This factory attaches the `Auth0-Client` HTTP header that identifies requests as originating from the UI Components SDK. The library name and version are defined centrally in `Auth0UniversalComponents/Version.swift`:
151
+
152
+
```swift
153
+
// Version.swift
154
+
let version ="1.0.0"
155
+
let libraryName ="universal-components-ios"
156
+
```
157
+
158
+
### Correct Usage
159
+
160
+
```swift
161
+
// In any UseCase
162
+
let client = MyAccountClientFactory.create(
163
+
token: apiCredentials.accessToken,
164
+
domain: dependencies.domain,
165
+
session: session
166
+
)
167
+
let result =tryawait client.authenticationMethods.enrollTOTP().start()
// DO NOT use Auth0.myAccount() directly — this bypasses telemetry headers
174
+
let client = Auth0.myAccount(token: token, domain: domain, session: session)
175
+
```
176
+
177
+
### Lint Enforcement
178
+
179
+
A custom SwiftLint rule (`no_direct_myaccount_client`) in `.swiftlint.yml` enforces this at build time. Any direct call to `Auth0.myAccount(` outside of `MyAccountClientFactory.swift` will produce a compilation error.
0 commit comments