MaikuB / MaikuB/flutter_appauth

iOS Crash when opening a deep link after completing an OAuth flow

Open
#161 2 comments 0 reactions 0 assignees View on GitHub
help wanted
Dominant language
Objective-C
Stars
308
Forks
301
Avg merge
2d 11h
Merged PRs (30d)
5

Description

**Steps**

- Complete normal SSO OAuth flow with Google
- Background the app and leave it running
- Open a deep link that would open the app.

Seems like FlutterAppauthPlugin may be resending something related to the oauth redirect
```
Process: Runner [23479]
Path: /Users/USER/Library/Developer/CoreSimulator/Devices/8AB9528E-704E-4970-B173-3185A286C3A5/data/Containers/Bundle/Application/0374302C-8FC8-4B72-8683-4C76A824F84A/Runner.app/Runner
Identifier: Runner
Version: 1.0.0 (1)
Code Type: X86-64 (Native)
Parent Process: launchd_sim [15443]
Responsible: SimulatorTrampoline [1343]
User ID: 501

Date/Time: 2020-11-26 10:08:54.358 -0500
OS Version: Mac OS X 10.15.7 (19H2)
Report Version: 12
Bridge OS Version: 4.6 (17P6610)
Anonymous UUID: 15B606B8-6927-3266-7438-BF57629709EB

Time Awake Since Boot: 7900 seconds

System Integrity Protection: enabled

Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY

Application Specific Information:
*** 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.'
terminating with uncaught exception of type NSException
abort() called
CoreSimulator 732.18.0.2 - Device: iPhone 12 Pro (8AB9528E-704E-4970-B173-3185A286C3A5) - Runtime: iOS 14.2 (18B79) - DeviceType: iPhone 12 Pro

Application Specific Backtrace 1:
0 CoreFoundation 0x00007fff2041daf2 __exceptionPreprocess + 242
1 libobjc.A.dylib 0x00007fff20177e78 objc_exception_throw + 48
2 CoreFoundation 0x00007fff2041d9d0 -[NSException initWithCoder:] + 0
3 AppAuth 0x00000001017f59cf -[OIDAuthorizationSession resumeExternalUserAgentFlowWithURL:] + 175
4 flutter_appauth 0x0000000103b8e24e -[FlutterAppauthPlugin application:openURL:options:] + 126
5 Flutter 0x00000001018ebf8b -[FlutterPluginAppLifeCycleDelegate application:openURL:options:] + 285
6 UIKitCore 0x00007fff24682241 __58-[UIApplication _applicationOpenURLAction:payload:origin:]_block_invoke + 686
7 UIKitCore 0x00007fff24681cd6 -[UIApplication _applicationOpenURLAction:payload:origin:] + 983
8 UIKitCore 0x00007fff2468eb4d -[UIApplication _handleNonLaunchSpecificActions:forScene:withTransitionContext:completion:] + 5228
9 UIKitCore 0x00007fff23acdbe6 -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 517
10 UIKitCore 0x00007fff23acec6d -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 208
11 UIKitCore 0x00007fff2416385f -[UIApplicationSceneClientAgent scene:handleEvent:withCompletion:] + 502
12 FrontBoardServices 0x00007fff25a7e8c7 -[FBSScene updater:didUpdateSettings:withDiff:transitionContext:completion:] + 530
13 FrontBoardServices 0x00007fff25aa8149 __94-[FBSWorkspaceScenesClient _queue_updateScene:withSettings:diff:transitionContext:completion:]_block_invoke_2 + 133

```

Contributor guide

Open the contributing guide

Research direction

Start with the reported reproduction steps and the FlutterAppauthPlugin application:openURL:options: entry point in the crash trace, then inspect OIDAuthorizationSession resumeExternalUserAgentFlowWithURL:. Confirm the crash when a deep link is opened after the OAuth flow has completed, and consider the issue done when that sequence no longer aborts while normal OAuth redirects still work.

Written by the indexing model from the issue text.

Assessment

Tech stack
flutter, ios, objective-c
Domain
authentication, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.