MaikuB / MaikuB/flutter_appauth

Raised Exception is not handled on iOS

Open
#552 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Objective-C
Stars
308
Forks
301
Avg merge
2d 11h
Merged PRs (30d)
5

Description

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](https://github.com/MaikuB/flutter_appauth/blob/0d96bcd0f0fb4924ac290f7170d84310d4a0ed9e/flutter_appauth/ios/Classes/AppAuthIOSAuthorization.m#L72C1-L109C31), where the exception is not caught in the authorize function.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in flutter_appauth/ios/Classes/AppAuthIOSAuthorization.m, especially the authorize function referenced by the issue. Reproduce the iOS login flow and tap Done while authorization is completing, then trace the OIDExternalUserAgentSession redirect handling. Done means this edge case no longer terminates the app with an uncaught exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
flutter, ios, objective-c
Domain
authentication, mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.