Auth0.swift Login issues

I’m working on integrating authentication with our auth0 tenant in a iOS application using the auth0.swift package. We are running into an issue when running the app in the iOS simulator (we have not been able to reproduce the issue on a physical device) both in our app and also the iOS sample app provided by auth0.

After setup (using our custom auth0 domain) as stated here in the auth0-ios-swift-sample repo on GitHub. The initial login attempt succeeds without any issues and i’m taken to the ProfileView and expected details are shown.

After stopping the app in xcode and running it again the below error messages are shown when the login process is triggered.

Updating the auth0 plist file and switching the the default domain stated on the auth0 application can sometimes solve the issue for one cycle. In subsequent attempts the sheet for Universal login will only show “Safari can’t open the page because the network connection was lost”.

Applying .useEphemeralSession() does not make a difference, behaviour is the same.

  • xcode: 16.3
  • macOS: Version 15.4.1 (24E263)
  • Apple Macbook Pro M4
  • auth0.swift 2.11.0

Any ideas what could be causing this issue or how to solve it?

Thanks!

nw_connection_copy_connected_local_endpoint_block_invoke [C1] Connection has no local endpoint
Type: Error | Timestamp: 2025-04-30 09:20:42.741004+02:00 | Process: SwiftSample | Library: Network | Subsystem: com.apple.network | Category: connection | TID: 0x7a3d
nw_connection_copy_connected_local_endpoint_block_invoke [C1] Connection has no local endpoint
Type: Error | Timestamp: 2025-04-30 09:20:42.741095+02:00 | Process: SwiftSample | Library: Network | Subsystem: com.apple.network | Category: connection | TID: 0x7a3d
quic_conn_retire_dcid unable to find DCID 01ec14bca4f65dc5f0ec47bc2af67ede7fdee490
Type: Fault | Timestamp: 2025-04-30 09:20:42.742763+02:00 | Process: SwiftSample | Library: libquic.dylib | Subsystem: com.apple.network | Category: quic | TID: 0x7a3d
quic_conn_change_current_path [C1.1.1.1:2] [-01ec14bca4f65dc5f0ec47bc2af67ede7fdee490] tried to change paths, but no alternatives were found
Type: Error | Timestamp: 2025-04-30 09:20:42.742834+02:00 | Process: SwiftSample | Library: libquic.dylib | Subsystem: com.apple.network | Category: quic | TID: 0x7a3d
nw_flow_service_writes Failing write request <nw_write_request> [57: Socket is not connected]
Type: Error | Timestamp: 2025-04-30 09:20:42.743879+02:00 | Process: SwiftSample | Library: Network | Subsystem: com.apple.network | Category:  | TID: 0x7a3d
nw_write_request_report [C1] Send failed with error "Socket is not connected"
Type: Error | Timestamp: 2025-04-30 09:20:42.743907+02:00 | Process: SwiftSample | Library: Network | Subsystem: com.apple.network | Category: connection | TID: 0x7a3d
Task <6D7BD20D-829D-41A2-87D4-CAB66E510C47>.<1> HTTP load failed, 466/0 bytes (error code: -1005 [4:-4])
Type: Error | Timestamp: 2025-04-30 09:20:42.744011+02:00 | Process: SwiftSample | Library: CFNetwork | Subsystem: com.apple.CFNetwork | Category: Default | TID: 0x7a3d
Connection 1: write error 1:57
Type: Error | Timestamp: 2025-04-30 09:20:42.744037+02:00 | Process: SwiftSample | Library: CFNetwork | Subsystem: com.apple.CFNetwork | Category: Default | TID: 0x7a3d
nw_protocol_implementation_lookup_path [C1.1.1.1:2] No path found for 29aafeb9ec54250a
Type: Error | Timestamp: 2025-04-30 09:20:42.744209+02:00 | Process: SwiftSample | Library: Network | Subsystem: com.apple.network | Category:  | TID: 0x7a3d
Connection 1: received failure notification
Type: Error | Timestamp: 2025-04-30 09:20:42.744989+02:00 | Process: SwiftSample | Library: CFNetwork | Subsystem: com.apple.CFNetwork | Category: Default | TID: 0x7a3d
nw_endpoint_handler_unregister_context [C1.1.1.1 104.18.25.222:443 failed socket-flow (satisfied (Path is satisfied), interface: en0[802.11], uses wifi)] Cannot unregister after flow table is released
Type: Error | Timestamp: 2025-04-30 09:20:42.745436+02:00 | Process: SwiftSample | Library: Network | Subsystem: com.apple.network | Category: connection | TID: 0x7a3a
Task <6D7BD20D-829D-41A2-87D4-CAB66E510C47>.<1> finished with error [-1005] Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." UserInfo={_kCFStreamErrorCodeKey=-4, NSUnderlyingError=0x600000c53270 {Error Domain=kCFErrorDomainCFNetwork Code=-1005 "(null)" UserInfo={NSErrorPeerAddressKey=<CFData 0x600002149ef0 [0x1e6ebb4f0]>{length = 16, capacity = 16, bytes = 0x100201bb681219de0000000000000000}, _kCFStreamErrorCodeKey=-4, _kCFStreamErrorDomainKey=4}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <6D7BD20D-829D-41A2-87D4-CAB66E510C47>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <6D7BD20D-829D-41A2-87D4-CAB66E510C47>.<1>"
), NSLocalizedDescription=The network connection was lost., NSErrorFailingURLStringKey=https://<MY_CUSTOM_DOMAIN>/oauth/token, NSErrorFailingURLKey=https://<MY_CUSTOM_DOMAIN>/oauth/token, _kCFStreamErrorDomainKey=4}
Type: Error | Timestamp: 2025-04-30 09:20:42.745496+02:00 | Process: SwiftSample | Library: CFNetwork | Subsystem: com.apple.CFNetwork | Category: Default | TID: 0x7a3d
nw_endpoint_flow_fillout_data_transfer_snapshot copy_info() returned NULL
Type: Error | Timestamp: 2025-04-30 09:20:42.745513+02:00 | Process: SwiftSample | Library: Network | Subsystem: com.apple.network | Category:  | TID: 0x7a3a
nw_connection_copy_connected_local_endpoint_block_invoke [C1] Connection has no local endpoint
Type: Error | Timestamp: 2025-04-30 09:20:42.745654+02:00 | Process: SwiftSample | Library: Network | Subsystem: com.apple.network | Category: connection | TID: 0x7a3a
Failed with: An unexpected error occurred. CAUSE: Unable to complete the operation. CAUSE: Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." UserInfo={_kCFStreamErrorCodeKey=-4, NSUnderlyingError=0x600000c53270 {Error Domain=kCFErrorDomainCFNetwork Code=-1005 "(null)" UserInfo={NSErrorPeerAddressKey=<CFData 0x600002149ef0 [0x1e6ebb4f0]>{length = 16, capacity = 16, bytes = 0x100201bb681219de0000000000000000}, _kCFStreamErrorCodeKey=-4, _kCFStreamErrorDomainKey=4}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <6D7BD20D-829D-41A2-87D4-CAB66E510C47>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <6D7BD20D-829D-41A2-87D4-CAB66E510C47>.<1>"
), NSLocalizedDescription=The network connection was lost., NSErrorFailingURLStringKey=https://<MY_CUSTOM_DOMAIN>/oauth/token, NSErrorFailingURLKey=https://<MY_CUSTOM_DOMAIN>/oauth/token, _kCFStreamErrorDomainKey=4}
Type: stdio

Hi @jonsing,

Welcome to the Auth0 Community!

I have reviewed your error trace, and it seems to indicate that there was a problem with the network. This was justified by the error message “Safari can’t open the page because the network connection was lost.”

You mentioned that it works initially, but fails on subsequent attempts after stopping and starting the app again. It also works on a physical device, but has issues with the simulator. It’s possible that something is happening with the simulator’s settings, like the network settings. I recommend checking there and verifying that everything is good.

Let me know how this goes for you.

Thanks,
Rueben