From 106bae2e3632e5a5727fa3bbc3b5150fa8a71134 Mon Sep 17 00:00:00 2001 From: Sai Venkat Desu Date: Thu, 2 May 2024 15:27:55 +0530 Subject: [PATCH 1/2] test: fixed redirect uri tests when https is being used as scheme --- Auth0Tests/WebAuthSpec.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Auth0Tests/WebAuthSpec.swift b/Auth0Tests/WebAuthSpec.swift index 1b51dfc0..cfe8f094 100644 --- a/Auth0Tests/WebAuthSpec.swift +++ b/Auth0Tests/WebAuthSpec.swift @@ -310,20 +310,20 @@ class WebAuthSpec: QuickSpec { if #available(iOS 17.4, macOS 14.4, *) { context("https") { it("should build with the domain") { - expect(newWebAuth().redirectURL?.absoluteString) == "https://\(Domain)/\(platform)/\(bundleId)/callback" + expect(newWebAuth().useHTTPS().redirectURL?.absoluteString) == "https://\(Domain)/\(platform)/\(bundleId)/callback" } it("should build with the domain and a subpath") { let subpath = "foo" let uri = "https://\(Domain)/\(subpath)/\(platform)/\(bundleId)/callback" - let webAuth = Auth0WebAuth(clientId: ClientId, url: DomainURL.appendingPathComponent(subpath)) + let webAuth = Auth0WebAuth(clientId: ClientId, url: DomainURL.appendingPathComponent(subpath)).useHTTPS() expect(webAuth.redirectURL?.absoluteString) == uri } it("should build with the domain and subpaths") { let subpaths = "foo/bar" let uri = "https://\(Domain)/\(subpaths)/\(platform)/\(bundleId)/callback" - let webAuth = Auth0WebAuth(clientId: ClientId, url: DomainURL.appendingPathComponent(subpaths)) + let webAuth = Auth0WebAuth(clientId: ClientId, url: DomainURL.appendingPathComponent(subpaths)).useHTTPS() expect(webAuth.redirectURL?.absoluteString) == uri } } From d9da13289b3edb8b8e588e1e8f75391eec7cd458 Mon Sep 17 00:00:00 2001 From: Sai Venkat Desu Date: Thu, 2 May 2024 15:28:32 +0530 Subject: [PATCH 2/2] fix: added .dataNotAllowed as well as a network error and updated tests for it --- Auth0/AuthenticationError.swift | 3 ++- Auth0Tests/AuthenticationErrorSpec.swift | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Auth0/AuthenticationError.swift b/Auth0/AuthenticationError.swift index faa2c235..66b24c15 100644 --- a/Auth0/AuthenticationError.swift +++ b/Auth0/AuthenticationError.swift @@ -154,6 +154,7 @@ public struct AuthenticationError: Auth0APIError { } let networkErrorCodes: [URLError.Code] = [ + .dataNotAllowed, .notConnectedToInternet, .networkConnectionLost, .dnsLookupFailed, @@ -183,7 +184,7 @@ extension AuthenticationError { return "Received error with code \(self.code)." } - + } // MARK: - Equatable diff --git a/Auth0Tests/AuthenticationErrorSpec.swift b/Auth0Tests/AuthenticationErrorSpec.swift index 95c45ae2..e5e92845 100644 --- a/Auth0Tests/AuthenticationErrorSpec.swift +++ b/Auth0Tests/AuthenticationErrorSpec.swift @@ -420,6 +420,7 @@ class AuthenticationErrorSpec: QuickSpec { it("should detect network error") { let networkErrorCodes: [URLError.Code] = [ + .dataNotAllowed, .notConnectedToInternet, .networkConnectionLost, .dnsLookupFailed,