Skip to content

iOS 13 ASWebAuthenticationSession sign-in alert dismissed without error after app entered background #468

@jongarate

Description

@jongarate

Describe the bug
On devices running iOS 13, whenever the browser (ASWebAuthenticationSession) is about to be displayed, the system fires the usual 'sign-in' alert. If another event pops to foreground (call, user locks the phone, etc...), upon returning the presentingViewController is correctly displayed but the alert is not visible anymore. In this scenario, the view is left idle waiting for the dialog to complete and the browser to be launched without any additional notification to the app.

To Reproduce
Steps to reproduce the behavior:

  1. Get to a UIViewController and initiate an auth process calling authStateByPresentingAuthorizationRequest:presentingViewController:callback:
  2. System 'sign-in' alert is displayed
  3. Lock the device
  4. Unlock it
  5. UIViewController is visible but the 'sign-in' alert is not

Expected behavior
Either the alert should show up when the app becomes active again (e.g. phone is unlocked), or the app should somehow be notified so that we can cancel the previous attempt and launch a new one.

Test device:

  • Device: iPhone SE
  • OS: iOS 13.2
  • Version: AppAuth-iOS tag 1.2.0

Additional context
Exploring app lifecycle callbacks the following behavior has been observed:

  • Whenever the alert is displayed applicationWillResignActive is called. Afterwards, when locking the phone, applicationDidEnterBackground is fired. Then, upon unlocking the device, applicationWillEnterForeground and applicationDidBecomeActive are called back to back.
  • In any regular UIViewController if the user locks the device, applicationWillResignActive and applicationDidEnterBackground are called back to back. If then unlocked, behavior remains same as before.

Metadata

Metadata

Assignees

No one assigned

    Labels

    platform-bugIssues caused by the platform, or client software outside the control of AppAuth.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions