diff --git a/main/docs/quickstart/native/ios-swift.mdx b/main/docs/quickstart/native/ios-swift.mdx index 838cce54d8..993d5afde6 100644 --- a/main/docs/quickstart/native/ios-swift.mdx +++ b/main/docs/quickstart/native/ios-swift.mdx @@ -163,7 +163,11 @@ Your AI assistant will automatically create your Auth0 application, fetch creden - Create `AuthenticationService.swift`: + Create `AuthenticationService.swift` to handle login, logout, and token storage. + + + **Use `CredentialsManager` for token storage.** The `CredentialsManager` class securely stores credentials in the Keychain and automatically refreshes expired access tokens. Always use it — do not store tokens in memory, `UserDefaults`, or `localStorage`. + 1. Right-click your project → **New File...** → **Swift File** 2. Name it `AuthenticationService` @@ -370,6 +374,10 @@ This is **required** for certain features to work properly: ### Programmatic Configuration + +Never hardcode `clientId` or `domain` values directly in Swift source files — they will be committed to version control. Read them from environment variables or a build-time configuration file at runtime. For most apps, prefer `Auth0.plist` (the default approach in this quickstart). + + Instead of using `Auth0.plist`, you can pass credentials directly in your code. This is useful when credentials need to be dynamic or environment-specific (e.g., different Auth0 tenants for dev/staging/production). **Replace `Auth0.webAuth()` calls with `Auth0.webAuth(clientId:domain:)`:**