MaikuB / flutter_appauth

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

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

Open MisterJimson opened 3 years ago

MisterJimson commented 3 years ago

Steps

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
MisterJimson commented 3 years ago

Looks like this only happens if the deep link has the same URI structure as the SSO Oauth redirect.

MaikuB commented 3 years ago

I saw this when trying to see if i could use the url_launcher plugin to see if that could be used for logout. Unfortunately, I don't know of a solution at the moment so any assistance would be much appreciated