MaikuB / flutter_appauth

A Flutter wrapper for AppAuth iOS and Android SDKs
274 stars 246 forks source link

Raised Exception is not handled on iOS #552

Open john-slow opened 1 month ago

john-slow commented 1 month ago

There is an edge case that occurs when the user clicks the "Done" button during login, which could potentially throw an error on the iOS platform:

* Terminating app due to uncaught exception 'An OAuth redirect was sent to a OIDExternalUserAgentSession after it already completed.', reason: 'An OAuth redirect was sent to a OIDExternalUserAgentSession after it already completed.'
*** First throw call stack:
(0x19f8a908c 0x19cbab2e4 0x19f9a4648 0x10238e284 0x10335b67c 0x1060fb1a4 0x1060cbe54 0x102d655b0 0x1a3123f1c 0x1a312396c 0x1c2c5c248 0x1c2c2c68c 0x19f8460f4 0x19f845144 0x10348271c 0x10348613c 0x1b8d5d3b8 0x1b8d5d338 0x1b8d5d210 0x19f87c088 0x19f87c01c 0x19f879b08 0x19f878d04 0x19f8785b8 0x1eb30e1c4 0x1a23ce2c0 0x1a247cddc 0x1a27a9b20 0x102e607e8 0x102e60760 0x102e60864 0x1c504cd34)
libc++abi: terminating due to uncaught exception of type NSException

This issue may be related to the following code, where the exception is not caught in the authorize function.

MaikuB commented 1 month ago

Thanks for raising it. Would you by chance be able to submit a PR on this one?

john-slow commented 1 month ago

Thanks for raising it. Would you by chance be able to submit a PR on this one?

Sure, I have created this pr to address this bug that you may review.