Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion main/docs/quickstart/native/ios-swift.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,11 @@ Your AI assistant will automatically create your Auth0 application, fetch creden
</Step>

<Step title="Create the Authentication Service" stepNumber={5}>
Create `AuthenticationService.swift`:
Create `AuthenticationService.swift` to handle login, logout, and token storage.

<Info>
**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`.
</Info>

1. Right-click your project → **New File...** → **Swift File**
2. Name it `AuthenticationService`
Expand Down Expand Up @@ -370,6 +374,10 @@ This is **required** for certain features to work properly:
<Accordion title="Advanced Integration">
### Programmatic Configuration

<Warning>
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).
</Warning>

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:)`:**
Expand Down
Loading