diff --git a/main/docs/libraries/auth0-android.mdx b/main/docs/libraries/auth0-android.mdx index 006dfae4c4..d12b82dad9 100644 --- a/main/docs/libraries/auth0-android.mdx +++ b/main/docs/libraries/auth0-android.mdx @@ -21,7 +21,7 @@ In your app's `build.gradle` dependencies section, add the following: ```kotlin lines dependencies { // Add the Auth0 Android SDK - implementation 'com.auth0.android:auth0:2.+' + implementation 'com.auth0.android:auth0:4.0.0' } ``` diff --git a/main/docs/libraries/auth0-swift.mdx b/main/docs/libraries/auth0-swift.mdx index b7fce9211d..e0f73c6385 100644 --- a/main/docs/libraries/auth0-swift.mdx +++ b/main/docs/libraries/auth0-swift.mdx @@ -4,11 +4,11 @@ title: Auth0.swift --- -Swift SDK for iOS, macOS, tvOS, and watchOS that enables you to seamlessly integrate Auth0 into your apps. Add login and logout, store credentials securely, and access user information. +Swift SDK for iOS, macOS, tvOS, watchOS, and visionOS that enables you to seamlessly integrate Auth0 into your apps. Add login and logout, store credentials securely, and access user information. **See the** [**GitHub repository**](https://github.com/auth0/Auth0.swift) -**Migrating from v1? Check the** [**Migration Guide**](https://github.com/auth0/Auth0.swift/blob/master/V2_MIGRATION_GUIDE.md) +**Migrating from v2? Check the** [**Migration Guide**](https://github.com/auth0/Auth0.swift/blob/master/V3_MIGRATION_GUIDE.md) @@ -22,7 +22,7 @@ Swift SDK for iOS, macOS, tvOS, and watchOS that enables you to seamlessly integ + [Web Auth](https://auth0.github.io/Auth0.swift/documentation/auth0/webauth) + [Credentials Manager](https://auth0.github.io/Auth0.swift/documentation/auth0/credentialsmanager) + [Authentication API Client](https://auth0.github.io/Auth0.swift/documentation/auth0/authentication) - + [Management API Client (Users)](https://auth0.github.io/Auth0.swift/documentation/auth0/users) + + [MFA API Client](https://auth0.github.io/Auth0.swift/documentation/auth0/mfaclient) * [FAQ](https://github.com/auth0/Auth0.swift/blob/master/FAQ.md): Answers some common questions about Auth0.swift. * [Auth0 Documentation:](https://auth0.com/docs) Explore our docs site and learn more about Auth0. @@ -30,9 +30,9 @@ Swift SDK for iOS, macOS, tvOS, and watchOS that enables you to seamlessly integ ### Requirements -* iOS 13.0+ / macOS 11.0+ / tvOS 13.0+ / watchOS 7.0+ -* Xcode 14.x -* Swift 5.7+ +* iOS 14.0+ / macOS 11.0+ / tvOS 14.0+ / watchOS 7.0+ / visionOS 1.0+ +* Xcode 16.x +* Swift 6.0+ @@ -61,7 +61,7 @@ Then, select the dependency rule and press **Add Package**. Add the following line to your `Podfile`: ```bash lines -pod 'Auth0', '~> 2.0' +pod 'Auth0', '~> 3.0' ``` Then, run `pod install`. @@ -71,7 +71,7 @@ Then, run `pod install`. Add the following line to your `Cartfile`: ```bash lines -github "auth0/Auth0.swift" ~> 2.0 +github "auth0/Auth0.swift" ~> 3.0 ``` Then, run `carthage bootstrap --use-xcframeworks`. @@ -117,14 +117,6 @@ Auth0 // ... ``` -##### For the Management API client (Users) - -```swift lines -Auth0 - .users(token: credentials.accessToken, domain: "{yourAuth0Domain}") - // ... -``` - ### Configure Web Auth (iOS / macOS) #### Configure callback URL and logout URL @@ -219,12 +211,12 @@ Auth0 Logging the user out involves clearing the Universal Login session cookie and then deleting the user's credentials from your application. -Call the `clearSession()` method in the action of your **Logout** button. Once the session cookie has been cleared, [delete the user's credentials](https://github.com/auth0/Auth0.swift/blob/master/EXAMPLES.md#clear-stored-credentials). +Call the `logout()` method in the action of your **Logout** button. Once the session cookie has been cleared, [delete the user's credentials](https://github.com/auth0/Auth0.swift/blob/master/EXAMPLES.md#clear-stored-credentials). ```swift lines Auth0 .webAuth() - .clearSession { result in + .logout { result in switch result { case .success: print("Session cookie cleared") @@ -239,7 +231,7 @@ Auth0 ```swift lines do { - try await Auth0.webAuth().clearSession() + try await Auth0.webAuth().logout() print("Session cookie cleared") // Delete credentials } catch { @@ -252,7 +244,7 @@ do { ```swift lines Auth0 .webAuth() - .clearSession() + .logout() .sink(receiveCompletion: { completion in switch completion { case .finished: diff --git a/main/docs/quickstart/native/ios-swift.mdx b/main/docs/quickstart/native/ios-swift.mdx index c2e8f8d8f8..2600d0b110 100644 --- a/main/docs/quickstart/native/ios-swift.mdx +++ b/main/docs/quickstart/native/ios-swift.mdx @@ -181,7 +181,7 @@ Your AI assistant will automatically create your Auth0 application, fetch creden @MainActor class AuthenticationService: ObservableObject { @Published var isAuthenticated = false - @Published var user: User? + @Published var user: UserProfile? @Published var isLoading = false @Published var errorMessage: String? @@ -203,8 +203,8 @@ Your AI assistant will automatically create your Auth0 application, fetch creden } isAuthenticated = true - // Get user info from the ID token - user = credentials.user + // Get the user profile from the stored ID token + user = try? credentialsManager.userProfile() } func login() async { @@ -213,15 +213,16 @@ Your AI assistant will automatically create your Auth0 application, fetch creden defer { isLoading = false } do { - let credentials = try await Auth0 + // offline_access is included in the default scope as of v3, shown here for clarity + _ = try await Auth0 .webAuth() .scope("openid profile email offline_access") + .useCredentialsManager(credentialsManager) .start() - _ = credentialsManager.store(credentials: credentials) isAuthenticated = true - // Get user info from the ID token - user = credentials.user + // Get the user profile from the stored ID token + user = try? credentialsManager.userProfile() } catch { errorMessage = "Login failed: \(error.localizedDescription)" } @@ -234,8 +235,8 @@ Your AI assistant will automatically create your Auth0 application, fetch creden do { try await Auth0 .webAuth() - .clearSession() - _ = credentialsManager.clear() + .useCredentialsManager(credentialsManager) + .logout() isAuthenticated = false user = nil } catch { @@ -277,12 +278,13 @@ Your AI assistant will automatically create your Auth0 application, fetch creden let credentials = try await Auth0 .webAuth() .scope("openid profile email offline_access") + .useCredentialsManager(credentialsManager) .useEphemeralSession() .start() ``` - When using ephemeral sessions, you don't need to call `clearSession()` on logout. Just clear the credentials from your app - there's no shared cookie to remove. + When using ephemeral sessions, you don't need to call `logout()` on the Web Auth client. Just clear the credentials from your app - there's no shared cookie to remove. @@ -376,7 +378,7 @@ Require Face ID or Touch ID to access stored credentials: ```swift private let credentialsManager: CredentialsManager = { - let manager = CredentialsManager(authentication: Auth0.authentication()) + var manager = CredentialsManager(authentication: Auth0.authentication()) manager.enableBiometrics( withTitle: "Unlock with Face ID", cancelTitle: "Cancel", @@ -409,7 +411,7 @@ For widgets, app extensions, or background tasks that need access tokens: let credentialsManager = CredentialsManager( authentication: Auth0.authentication(), storeKey: "credentials", - storage: .shared(withIdentifier: "group.com.example.myapp") + storage: SimpleKeychain(accessGroup: "group.com.example.myapp") ) ```