Skip to content

Support for Using Plugin in App Extension (UIApplication.shared.delegate?.window is nil) #167

Open
@GabrielRosenberg

Description

@GabrielRosenberg

Description

When using flutter_web_auth_2 from an iOS app extension, the plugin fails because it tries to obtain the rootViewController using UIApplication.shared.delegate?.window??.rootViewController, which is nil in extension contexts. This causes the authentication session to throw an ACQUIRE_ROOT_VIEW_CONTROLLER_FAILED error, even though the extension itself has access to the appropriate UIViewController.

There is currently no way to manually provide or override the presentationContextProvider used by ASWebAuthenticationSession from what I see, is there any existing solution to this issue?

To Reproduce

// In an app extension using flutter_web_auth_2:
await FlutterWebAuth2.authenticate(
  url: 'https://example.com/auth',
  callbackUrlScheme: 'myapp',
);

Device (please complete the following information!)

  • Device: iPhone 16 simulator
  • OS: iOS 18.2
  • Browser: Safari
  • flutter_web_auth_2 version: ^5.0.0-alpha.0

Metadata

Metadata

Assignees

Labels

apple[See issue #68] Just Apple being Apple again...compatibilitySomething is not compatible with flutter_web_auth

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions