AppAuth-iOS icon indicating copy to clipboard operation
AppAuth-iOS copied to clipboard

Crash fix - when cancelling an authentication session

Open Prash88 opened this issue 8 months ago • 2 comments

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.

Prash88 avatar Apr 02 '25 15:04 Prash88

Verified the crash described occurs in iOS example app with Okta and that the proposed fix prevents the crash.

camden-king avatar Apr 03 '25 21:04 camden-king

@Prash88 Do you mind fixing the failing tests, please?

brnnmrls avatar Apr 22 '25 17:04 brnnmrls