Skip to content

Commit

Permalink
Fix crash when the bundle ID contains characters not allowed in URL s…
Browse files Browse the repository at this point in the history
…chemes (#786)
  • Loading branch information
Widcket authored Aug 2, 2023
1 parent 9d970f3 commit d621132
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Auth0/Auth0WebAuth.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,13 @@ 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.url.path)
.appendingPathComponent(self.platform)
.appendingPathComponent(bundleIdentifier)
.appendingPathComponent("callback")
Expand Down

0 comments on commit d621132

Please sign in to comment.