From 29a0224a9e4a39449a75b10e13ba0f1be31a4ba5 Mon Sep 17 00:00:00 2001 From: Rita Zerrizuela Date: Wed, 2 Aug 2023 14:47:42 +0100 Subject: [PATCH 1/2] Fix crash when the bundle ID starts with numbers --- Auth0/Auth0WebAuth.swift | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Auth0/Auth0WebAuth.swift b/Auth0/Auth0WebAuth.swift index bc84ea67..ab39fe32 100644 --- a/Auth0/Auth0WebAuth.swift +++ b/Auth0/Auth0WebAuth.swift @@ -35,9 +35,11 @@ final class Auth0WebAuth: WebAuth { } lazy var redirectURL: URL? = { - guard let bundleIdentifier = Bundle.main.bundleIdentifier else { return nil } - var components = URLComponents(url: self.url, resolvingAgainstBaseURL: true) - components?.scheme = bundleIdentifier + guard let bundleIdentifier = Bundle.main.bundleIdentifier, + let domain = self.url.host, + let baseURL = URL(string: "\(bundleIdentifier)://\(domain)") else { return nil } + + var components = URLComponents(url: baseURL, resolvingAgainstBaseURL: true) return components?.url? .appendingPathComponent(self.platform) .appendingPathComponent(bundleIdentifier) From 78ae68d71b0345b69f5a4ae911c41ddf88e6ac7f Mon Sep 17 00:00:00 2001 From: Rita Zerrizuela Date: Wed, 2 Aug 2023 16:11:57 +0100 Subject: [PATCH 2/2] Append the path of the base URL --- Auth0/Auth0WebAuth.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Auth0/Auth0WebAuth.swift b/Auth0/Auth0WebAuth.swift index ab39fe32..f2fc7308 100644 --- a/Auth0/Auth0WebAuth.swift +++ b/Auth0/Auth0WebAuth.swift @@ -41,6 +41,7 @@ final class Auth0WebAuth: WebAuth { var components = URLComponents(url: baseURL, resolvingAgainstBaseURL: true) return components?.url? + .appendingPathComponent(self.url.path) .appendingPathComponent(self.platform) .appendingPathComponent(bundleIdentifier) .appendingPathComponent("callback")