Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI API called on a background thread iOS 13 using Legacy Authentication #308

Closed
dunada opened this issue Sep 17, 2019 · 3 comments
Closed

Comments

@dunada
Copy link

dunada commented Sep 17, 2019

Description

After update Auth0.swift to version 1.17.1 When I hit the login button, the app freezes for a few seconds and the proceeds normally, and I get the following message in the terminal:

=================================================================
Main Thread Checker: UI API called on a background thread: -[UIViewController presentingViewController]
PID: 1180, TID: 314715, Thread name: (none), Queue name: NSOperationQueue 0x10b2210b0 (QOS: UNSPECIFIED), QoS: 0
Backtrace:
4 Auth0 0x00000001088be3dc $s5Auth013SafariWebAuthC03newB0_8callbackSo22SFSafariViewControllerC_yAA6ResultOyAA11CredentialsCGct10Foundation3URLV_yALctFyALcfU_ + 192
5 Auth0 0x000000010889e99c $s5Auth04PKCEV11credentials4from8callbackySDyS2SG_yAA6ResultOyAA11CredentialsCGctFyALcfU_ + 640
6 Auth0 0x00000001088a2f64 $s5Auth06ResultOyAA11CredentialsCGIegg_AFIegn_TR + 36
7 Auth0 0x000000010888ad9c $s5Auth020authenticationObject4from8callbackyAA8ResponseVyAA19AuthenticationErrorCG_yAA6ResultOyxGXEtAA17JSONObjectPayloadRzlFAA11CredentialsC_Tg5 + 332
8 Auth0 0x00000001088b2a70 $s5Auth07RequestV5startyyyAA6ResultOyxGcFy10Foundation4DataVSg_So13NSURLResponseCSgs5Error_pSgtcfU_AA11CredentialsC_AA014AuthenticationH0CTg5 + 280
9 Auth0 0x00000001088b5398 $s5Auth07RequestV5startyyyAA6ResultOyxGcFy10Foundation4DataVSg_So13NSURLResponseCSgs5Error_pSgtcfU_AA11CredentialsC_AA014AuthenticationH0CTg5TA + 32
10 Auth0 0x00000001088b2d6c $s10Foundation4DataVSgSo13NSURLResponseCSgs5Error_pSgIegggg_So6NSDataCSgAGSo7NSErrorCSgIeyByyy_TR + 148
11 Sonic-Inhouse 0x00000001039e7a30 __SplunkNSCFURLSessionDataTaskWithRequestCompletionHandler_block_invoke + 460
12 Dynatrace 0x0000000105e810ec __74-[DTXURLSessionInstrumentation dataTaskWithRequest_DTX:completionHandler:]_block_invoke + 792
13 CFNetwork 0x00000001be1aad7c CFNetServiceBrowserSearchForServices + 93016
14 CFNetwork 0x00000001be1bb2b0 _CFHTTPMessageSetResponseProxyURL + 9540
15 Foundation 0x00000001bb35d65c 32C04A3C-D431-351A-AE6A-1D87EE3CFFB6 + 1132124
16 Foundation 0x00000001bb267448 32C04A3C-D431-351A-AE6A-1D87EE3CFFB6 + 123976
17 Foundation 0x00000001bb35f8e4 32C04A3C-D431-351A-AE6A-1D87EE3CFFB6 + 1140964
18 Foundation 0x00000001bb2670e0 32C04A3C-D431-351A-AE6A-1D87EE3CFFB6 + 123104
19 Foundation 0x00000001bb3602dc 32C04A3C-D431-351A-AE6A-1D87EE3CFFB6 + 1143516
20 Foundation 0x00000001bb35fda8 32C04A3C-D431-351A-AE6A-1D87EE3CFFB6 + 1142184
21 libdispatch.dylib 0x000000010af11298 _dispatch_block_async_invoke2 + 104
22 libdispatch.dylib 0x000000010af02c04 _dispatch_client_callout + 16
23 libdispatch.dylib 0x000000010af05808 _dispatch_continuation_pop + 524
24 libdispatch.dylib 0x000000010af04c88 _dispatch_async_redirect_invoke + 624
25 libdispatch.dylib 0x000000010af14168 _dispatch_root_queue_drain + 376
26 libdispatch.dylib 0x000000010af14a90 _dispatch_worker_thread2 + 156
27 libsystem_pthread.dylib 0x00000001bacb5f64 _pthread_wqthread + 212
28 libsystem_pthread.dylib 0x00000001bacb8ae0 start_wqthread + 8

=================================================================

Environment

  • Auth0.swift version 1.17.1
  • iOS version 13
  • Carthage
  • Xcode GM Seed 2

Reproduction

Try to login in iOS 13 with the Auth0 version 1.17.1 using the legacy authentication.

The code I used for that:

func login(params: [String: Any], completion: @escaping (BFFAuthenticable.AuthResult) -> Void) {
    var auth = Auth0
        .webAuth(
            clientId: clientId,
            domain: domain)
        .scope("openid offline_access") //offline_access is required for refresh token...
        .audience(audience)
    let auth0Params: [String: String] = [
        "connection": connection,
        "flow": "login",
        "prompt": "login"
    ]
    
    
    auth = auth.parameters(auth0Params)
    
    if #available(iOS 11.0, *) {
        //Prevent ios 11 from showing a prompt by using `SFSafariViewController` vs. `SFAuthenticationSession`
        auth = auth.useLegacyAuthentication()
    }
    
    auth.start {
        result in
        self.handle(result, completion: completion)
    }
}
@cocojoe
Copy link
Member

cocojoe commented Sep 17, 2019

Please add the information requested in the issue template, it's also not clear was this a crash or was it the UI thread checker which will throw an exception as a warning.

Sounds like auth0/Lock.swift#565 which started in Xcode 11 with iOS 13. Doesn't present in iOS 12.

@dunada
Copy link
Author

dunada commented Sep 17, 2019

Sorry @cocojoe I just fixed the description, Yes you are right it looks like the auth0/Lock.swift#565

@colin-chan
Copy link
Contributor

Is this going to be fixed for auth0/Auth0.swift. A fix was released for auth0/Lock.swift (#565) but the same problem hasn't been corrected for this project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants