Crash fix - when cancelling an authentication session
Steps to repro
In Example app,
Tap sign in, hit continue. Move the app to the background. Go to Settings > Safari > Clear History and Website Data. Go into the app again. A new permission dialog is shown. Tap Cancel. App crashes.
Recording from example app: https://streamable.com/5m16cx
Reasons for crash
The crash happens because of ASWebAuthenticationSession getting deallocated during or immediately after completion handler http://ww.openradar.appspot.com/FB12132525
Fix explanation
As suggested, this crash can be mitigated by intentionally retaining the authentication session until after the dismiss animation is complete.
Verified the crash described occurs in iOS example app with Okta and that the proposed fix prevents the crash.
@Prash88 Do you mind fixing the failing tests, please?