Auth0.swift icon indicating copy to clipboard operation
Auth0.swift copied to clipboard

Auth0 webAuth not working on iOS 18

Open PedrinhoDS opened this issue 1 year ago • 16 comments

Checklist

  • [X] The issue can be reproduced in the Auth0.swift sample app (or N/A).
  • [X] I have looked into the Readme, Examples, and FAQ and have not found a suitable solution or answer.
  • [X] I have looked into the API documentation and have not found a suitable solution or answer.
  • [X] I have searched the issues and have not found a suitable solution or answer.
  • [X] I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • [X] I agree to the terms within the Auth0 Code of Conduct.

Description

WebAuth has stopped working on iOS 18. The web modal displays correctly the first time, but when attempting to authenticate, an error appears. Upon reopening, the CSS appears to be broken.

Reproduction

Launch Auth0.webauth() to a device with iOS 18

Additional context

No response

Auth0.swift version

2.8.0

Platform

iOS

Platform version(s)

18

Xcode version

15 and 16

Package manager

Swift Package Manager

PedrinhoDS avatar Sep 18 '24 13:09 PedrinhoDS

@PedrinhoDS, Can you share a video recording of it ?

desusai7 avatar Sep 18 '24 13:09 desusai7

@desusai7 sure, this build is from Xcode 16, but I also faced the same issue when I ran from Xcode 15.4

https://github.com/user-attachments/assets/1ef1b885-aff8-49ab-8762-10eb991d7963

PedrinhoDS avatar Sep 18 '24 13:09 PedrinhoDS

@PedrinhoDS, were you facing this issue on a real device as well ?

We had also observed minor ui inconsistency issues happening only on simulator.

And were you using any new options in safari like hide distracting items ?

desusai7 avatar Sep 18 '24 13:09 desusai7

So, I just tested it on a physical device (iPhone 14 Pro Max), and it worked as expected. I think it may be happening only on simulators.

Regarding the new options in Safari, I'm using a fresh simulator; I didn't change any configuration there

PedrinhoDS avatar Sep 18 '24 13:09 PedrinhoDS

I see, can you check if this issue is happening for you on simulator when using SFSafariViewController as the user agent ?

You can follow the steps here on how to configure SFSafariViewController as the user agent.

desusai7 avatar Sep 18 '24 13:09 desusai7

Just got this crash and it may have something that may be helpful for you.

com.apple.WebKit.Networking quit unexpectedly


Exception Type:  EXC_BAD_ACCESS (SIGKILL)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000beaddcbd8890 -> 0x00003eaddcbd8890 (possible pointer authentication failure)
Exception Codes: 0x0000000000000001, 0x0000beaddcbd8890
VM Region Info: 0x3eaddcbd8890 is not in any region.  Bytes after previous region: 68435417335953  Bytes before following region: 36636662593392
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      commpage (reserved)        1000000000-7000000000   [384.0G] ---/--- SM=NUL  reserved VM address space (unallocated)
--->  GAP OF 0x5f9000000000 BYTES
      MALLOC_NANO              600000000000-600020000000 [512.0M] rw-/rwx SM=PRV  
Termination Reason: PAC_EXCEPTION 1 

Triggered by Thread:  3

Thread 0:: JavaScriptCore libpas scavenger
0   libsystem_kernel.dylib        	       0x104c9c670 __psynch_cvwait + 8
1   libsystem_pthread.dylib       	       0x104dc39cc _pthread_cond_wait + 1216
2   JavaScriptCore                	       0x1987071e0 scavenger_thread_main + 1148
3   libsystem_pthread.dylib       	       0x104dc3414 _pthread_start + 104
4   libsystem_pthread.dylib       	       0x104dbe5e0 thread_start + 8

Thread 1:: com.apple.NSURLConnectionLoader
0   libsystem_kernel.dylib        	       0x104c99170 mach_msg2_trap + 8
1   libsystem_kernel.dylib        	       0x104caa660 mach_msg2_internal + 76
2   libsystem_kernel.dylib        	       0x104ca1318 mach_msg_overwrite + 532
3   libsystem_kernel.dylib        	       0x104c994e8 mach_msg + 20
4   CoreFoundation                	       0x18041ab60 __CFRunLoopServiceMachPort + 156
5   CoreFoundation                	       0x180415224 __CFRunLoopRun + 1160
6   CoreFoundation                	       0x180414960 CFRunLoopRunSpecific + 536
7   CFNetwork                     	       0x1849b9510 +[__CFN_CoreSchedulingSetRunnable _run:] + 372
8   Foundation                    	       0x180f51d6c __NSThread__start__ + 720
9   libsystem_pthread.dylib       	       0x104dc3414 _pthread_start + 104
10  libsystem_pthread.dylib       	       0x104dbe5e0 thread_start + 8

Thread 2:
0   libsystem_pthread.dylib       	       0x104dbe5cc start_wqthread + 0

Thread 3 Crashed::  Dispatch queue: com.apple.NWURLSession
0   libobjc.A.dylib               	       0x18008df74 objc_autoreleaseReturnValue + 88
1   Network                       	       0x1883e3bc0 -[NWURLErrorUserInfoDictionary objectForKey:] + 112
2   CoreFoundation                	       0x1804b2fc8 -[NSDictionary getObjects:andKeys:count:] + 208
3   CoreFoundation                	       0x180403c8c __NSDictionaryEnumerate + 588
4   CoreFoundation                	       0x1804b4bf8 -[NSDictionary __apply:context:] + 96
5   CoreFoundation                	       0x1803d695c _CFErrorFormatDebugDescriptionAux + 564
6   CoreFoundation                	       0x1803d6ae8 _CFErrorCreateRedactedDescription + 84
7   Foundation                    	       0x180e70638 -[NSError redactedDescription] + 12
8   Foundation                    	       0x180f02794 _NS_os_log_callback + 224
9   libsystem_trace.dylib         	       0x1800a28c8 _os_log_fmt_flatten_NSCF + 60
10  libsystem_trace.dylib         	       0x1800a2154 _os_log_fmt_flatten_object_impl + 164
11  libsystem_trace.dylib         	       0x1800b1288 _os_log_impl_flatten_and_send + 1892
12  libsystem_trace.dylib         	       0x1800b0b0c _os_log + 164
13  libsystem_trace.dylib         	       0x1800b36d8 _os_log_impl + 20
14  Network                       	       0x1880fd4d8 -[NWURLSessionTask complete] + 700
15  Network                       	       0x1880f8900 -[NWURLSessionTask completeTaskWithError:] + 184
16  Network                       	       0x1880fe7d0 __32-[NWURLSessionTask readResponse]_block_invoke + 456
17  Network                       	       0x18836c158 __31-[NWURLLoaderHTTP readResponse]_block_invoke + 3504
18  libdispatch.dylib             	       0x180188594 _dispatch_block_async_invoke2 + 104
19  libdispatch.dylib             	       0x180178de0 _dispatch_client_callout + 16
20  libdispatch.dylib             	       0x180180f60 _dispatch_lane_serial_drain + 956
21  libdispatch.dylib             	       0x180181a98 _dispatch_lane_invoke + 388
22  libdispatch.dylib             	       0x1801828e4 _dispatch_workloop_invoke + 776
23  libdispatch.dylib             	       0x18018cf44 _dispatch_root_queue_drain_deferred_wlh + 276
24  libdispatch.dylib             	       0x18018c5a0 _dispatch_workloop_worker_thread + 440
25  libsystem_pthread.dylib       	       0x104dbf814 _pthread_wqthread + 284
26  libsystem_pthread.dylib       	       0x104dbe5d4 start_wqthread + 8

Thread 4:
0   libsystem_pthread.dylib       	       0x104dbe5cc start_wqthread + 0

Thread 5:
0   libsystem_pthread.dylib       	       0x104dbe5cc start_wqthread + 0

Thread 6:
0   libsystem_pthread.dylib       	       0x104dbe5cc start_wqthread + 0

Thread 7:
0   libsystem_pthread.dylib       	       0x104dbe5cc start_wqthread + 0


Thread 3 crashed with ARM Thread State (64-bit):
    x0: 0x0000beaddcbd8870   x1: 0x0000000000000000   x2: 0x0000000000000003   x3: 0x0000000104d04b70
    x4: 0x0000000000000004   x5: 0x000000000000001f   x6: 0x000000000000006e   x7: 0x000000000000002a
    x8: 0x0000beaddcbd8870   x9: 0x000000016b24f0e0  x10: 0x0f007ffffffffff8  x11: 0x000000000000001f
   x12: 0x000000000000001f  x13: 0x0000000105109eb0  x14: 0x01000001ec0cdd89  x15: 0x00000001ec0cdd88
   x16: 0x0000000104dbe65c  x17: 0x00000001804da96c  x18: 0x0000000000000000  x19: 0x0000600002108870
   x20: 0x00000001883e3bc0  x21: 0x0000000000000000  x22: 0x00000001051069c0  x23: 0x0000600000209ea0
   x24: 0x0000000000000006  x25: 0x0000000000000000  x26: 0x000000016b24da36  x27: 0x000000016b24cb50
   x28: 0x0000000000000000   fp: 0x000000016b24c660   lr: 0x000000018008df5c
    sp: 0x000000016b24c640   pc: 0x000000018008df74 cpsr: 0x20001000
   far: 0x0000beaddcbd8890  esr: 0x92000004 (Data Abort) byte read Translation fault

Binary Images:
       0x104f48000 -        0x104fd3fff dyld (*) <f635824e-318b-3f0c-842c-c369737f2b68> /usr/lib/dyld
       0x104c38000 -        0x104c3ffff com.apple.WebKit.Networking (*) <6584e9ed-bc7e-37b1-96c6-59660a467da0> /Volumes/VOLUME/*/com.apple.WebKit.Networking
       0x104e30000 -        0x104e73fff dyld_sim (*) <6499b476-4b66-3148-b85b-496aa7ea0690> /Volumes/VOLUME/*/dyld_sim
       0x104d04000 -        0x104d0bfff libsystem_platform.dylib (*) <3394e9ca-eb51-322d-a5eb-4d895d3b1c14> /usr/lib/system/libsystem_platform.dylib
       0x104c98000 -        0x104cd3fff libsystem_kernel.dylib (*) <0f9f96fe-6b1c-3253-a33a-c9e4a0c2a386> /usr/lib/system/libsystem_kernel.dylib
       0x104dbc000 -        0x104dcbfff libsystem_pthread.dylib (*) <3df3256f-466e-37bc-b995-a5a9956e1415> /usr/lib/system/libsystem_pthread.dylib
       0x19715e000 -        0x1988d4fbf com.apple.JavaScriptCore (8619) <6d086b92-41ca-32fd-a496-c208f72ab34b> /Volumes/VOLUME/*/JavaScriptCore.framework/JavaScriptCore
               0x0 - 0xffffffffffffffff ??? (*) <00000000-0000-0000-0000-000000000000> ???
       0x18038b000 -        0x18075afff com.apple.CoreFoundation (6.9) <5f40c0e3-6b50-30c6-a686-3ab03c9a5404> /Volumes/VOLUME/*/CoreFoundation.framework/CoreFoundation
       0x1847b2000 -        0x184b30fff com.apple.CFNetwork (1.0) <722d2929-fe22-39d0-81cf-4cf7e2bb9caa> /Volumes/VOLUME/*/CFNetwork.framework/CFNetwork
       0x1807da000 -        0x181420fff com.apple.Foundation (6.9) <1a4bc02e-f4dc-3ab5-9bb7-61d28064ffe8> /Volumes/VOLUME/*/Foundation.framework/Foundation
       0x180064000 -        0x18009fda3 libobjc.A.dylib (*) <eea0093e-1937-3650-ac0f-430162fd94d5> /Volumes/VOLUME/*/libobjc.A.dylib
       0x187a43000 -        0x188841fff com.apple.Network (1.0) <8a1425de-91dd-37d4-8c8b-e279159a7155> /Volumes/VOLUME/*/Network.framework/Network
       0x1800a0000 -        0x1800b9fff libsystem_trace.dylib (*) <dd366ca4-ca49-3b37-9b2f-2d37ce5444de> /Volumes/VOLUME/*/libsystem_trace.dylib
       0x180175000 -        0x1801b9fff libdispatch.dylib (*) <71b0ee55-14d3-363f-88de-27caee135593> /Volumes/VOLUME/*/libdispatch.dylib

EOF

-----------
Full Report
-----------

PedrinhoDS avatar Sep 18 '24 14:09 PedrinhoDS

@PedrinhoDS, Can you share the steps to reproduce this crash, and did this crash happen on simulator ?

desusai7 avatar Sep 18 '24 14:09 desusai7

So, I just built the app with this configuration and opened the web auth dialog, as soon the dialog loads, I get the crash

            _ = try? await Auth0
                .webAuth()
                .provider(WebAuthentication.safariProvider())
                .audience("audienceurl")
                .useHTTPS()
                .start()

And the crash happens only on the simulator

PedrinhoDS avatar Sep 18 '24 14:09 PedrinhoDS

Do you have associated domains configured and was this issue happening for you on real device as well ?

desusai7 avatar Sep 18 '24 14:09 desusai7

Yes, I do have associated domains configured, and no, its only happening on simulators

PedrinhoDS avatar Sep 18 '24 14:09 PedrinhoDS

The issue seems to be something related to simulators running on iOS 18, we will investigate this, thank you for reporting this and sharing all the information swiftly.

desusai7 avatar Sep 18 '24 14:09 desusai7

Hi, I have the same issue on iOS 18 simulator with the Flutter package. Everything is fine on the same simulator device, iOS 17.5.

tijee avatar Sep 19 '24 13:09 tijee

Hello,

I'm having a similar issue on the iOS 18 simulator with the React Native Package. Everything is fine on a real device and/or an older iOS version. Once a webauth session is initiated, this is the login screen...

image

After some time, the actual Macbook reports that the SafariViewService has exited.

image

Thanks.

Happy to provide more information if that would be helpful!

luv-somani-es avatar Sep 26 '24 18:09 luv-somani-es

I too am running across this issue. The only work around is to disable my local VPN. This is happening when I am on Xcode 16, not 15.1.

fal3 avatar Oct 01 '24 14:10 fal3

Simulator Screenshot - iPhone 16 Pro - 2024-10-02 at 11 54 43

Hi, I am also having the same issue. How can we solve it?

furrki avatar Oct 02 '24 08:10 furrki

Hello, I am having the same issue, I have 2 projects, one using the react-native-auth0 package, Same issue on both of them.

dkumar-carfax avatar Oct 03 '24 14:10 dkumar-carfax

@desusai7 Is there an update to this issue?

fal3 avatar Oct 31 '24 14:10 fal3

We noticed that emulators are now working on iOS 18 with Xcode 16 running. No updates to the Swift SDK have been made (running v2.9.0), and no tenant updates performed.

Anyone else also seeing this fixed?

WorldOfByrd avatar Dec 16 '24 20:12 WorldOfByrd

Bug on - iOS 18, Xcode - 16. I am using Auth0 - 2.0.0 SwiftUI Native iOS application. I am not even getting SSO alert to login getting error - Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior (<SFAuthenticationViewController: 0x7fa958926a00>)

Then i remove .useHTTPS() after that i am getting blank page and app become unresponsive on iOS simulator, but running fine on physical device.

sssuourabh avatar Jan 02 '25 18:01 sssuourabh

Hi everyone,

The iOS simulator issue seems to be fixed on the 18.2 simulator:

https://github.com/user-attachments/assets/4d1d685e-7947-443e-8cf2-1a084d9aa2a9

Whereas it is present on the 18.1 simulator:

https://github.com/user-attachments/assets/94c5ef57-ab2a-40cf-9628-24855d69aca3

Closing as it's a simulator issue that's now been fixed.

Widcket avatar Jan 10 '25 17:01 Widcket