Hello,
I have a swiftui app targeting ios 17+ using Auth0 package 2.1.0. Unfortunately, 90% of the time my app is rejected from the app store because when the tester clicks on the login button or create account button nothing happens because there is an error. If they wait 3-5 seconds before clicking it (or click it again after 3-5 seconds) will generally work but it is inconsistent. The error in the console is this:
An unexpected error occurred. CAUSE: Error Domain=com.apple.AuthenticationServices.WebAuthenticationSession Code=1 “Application with identifier xxxxxxxxx is not associated with domain yyyyyyyy. Using HTTPS callbacks requires Associated Domains using the webcredentials
service type for yyyyyyyy.” UserInfo={NSLocalizedFailureReason=Application with identifier xxxxxxxx is not associated with domain yyyyyyyy. Using HTTPS callbacks requires Associated Domains using the webcredentials
service type for yyyyyyyyyyy.}
I can assure you that overall I have no issues with this on my and my testers devices, in test flight, xcode, on real devices and simulators but for some reason at start up, this error sometimes happens and it nearly always happens for testers and I don’t know what to do about it.
How can I resolve this? Any help anyone can provide would be absolutely amazing!
Here is my swiftui code that is triggered on button click:
@MainActor
func fallbackToAuth0Login(loginScreen: Bool = true) {
if let aud = Bundle.main.infoDictionary?["AUTH0_AUDIENCE"] as? String {
Auth0
.webAuth()
.useHTTPS()
.parameters(["screen_hint": loginScreen ? "login" : "signup"])
.audience(aud)
.scope("openid profile email offline_access")
.start { result in
switch result {
case .success(let credentials):
completeLogin(creds: credentials)
case .failure(let error):
print("Login Failed with: \(error)")
}
}
}
}```