AppAuth-iOS: OIDAuthState.authState fails to show browser on iOS 13

Describe the bug When built with 11.0 beta (11M336w) for iOS 13 beta 1, OIDAuthState.authState(byPresenting: request, presenting: parentController) returns the following error:

Error Domain=org.openid.appauth.general Code=-3 "(null)" UserInfo={NSUnderlyingError=0x6000034351d0 {Error Domain=com.apple.AuthenticationServices.WebAuthenticationSession Code=2 "Cannot start ASWebAuthenticationSession without providing presentation context. Set presentationContextProvider before calling -start." UserInfo={NSDebugDescription=Cannot start ASWebAuthenticationSession without providing presentation context. Set presentationContextProvider before calling -start.}}}

Expected behavior Show identity provider’s authentication page.

Smartphone (please complete the following information):

  • Device: iPhone XS
  • OS: iOS 13 Beta 1

Additional context API has worked as expected with previous versions. I’m not sure is there something to be updated in AppAuth library or is there a bug in iOS 13 Beta that causes this behaviour, but I think it’s worth to investigate.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 8
  • Comments: 25 (4 by maintainers)

Most upvoted comments

I have the same error (Error Domain=org.openid.appauth.general Code=-3). Does anyone have status about the error? I have pod ‘AppAuth’, ‘~> 1.2.0’

We installed the ios13beta branch to get the login to work again for iOS 13 but the authentication instantly fails. In our logs we can see these errors:

[strings] ERROR: org.openid.appauth.general not found in table Error of bundle CFBundle 0x10cd09200 </System/Library/Frameworks/CoreFoundation.framework> (framework, loaded)

Authorization error: The operation couldn’t be completed. (ORG.OPENID.APPAUTH.GENERAL error -3.)

Any input on this?

I have consumed 1.2.0 version which says iOS 13 support available. Still, I am facing this issue. I am using Xcode 11 GM seed and app auth 1.2.0. Please let me know which version to consume for ios 13 to get rid of this issue.

Thanks for the initial solution, great to have it working again. But I’ve ran into an issue in combination with iOS13 multi-window support. The current solution takes the keyWindow of the UIApplication, but the keyWindow property has been deprecated in iOS13.

(Just to prevent confusion: If you create multiple “windows”, you actually create multiple (window)scenes, where each one can have multiple windows.)

Thus, when dealing with multiple scenes , there is no (single) keyWindow anymore. Calling UIApplication.keyWindow can return a UIWindow of any of scene, even from a scene that is currently in the background. To prevent this from happening, I’ve implemented a solution in pull request #428 where the window of a fitting scene is selected as the presentationAnchor. The fix also doesn’t break anything if the app has no multi-window support, since in that case there is exactly one windowScene.