AppAuth-iOS icon indicating copy to clipboard operation
AppAuth-iOS copied to clipboard

OIDAuthState.authState fails to show login browser on iOS 13

Open chintu-github opened this issue 6 years ago • 27 comments

HI Team,

I am working on iOS 13 support for my framework. My solution environment is following:

  • AppAuth 1.2.0
  • Xcode 11 GM seed

I have tested in 1.1.0 also.

While launching web browser from my component, the alert is getting disappeared and getting below error:

Printing description of authorizationError:

Error Domain=org.openid.appauth.general Code=-3 "(null)" UserInfo={NSUnderlyingError=0x600002816b50 {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.}}}

Please help me which verison to take. I saw one more issue was raised like this but it was in iOS 13 beta branch.

chintu-github avatar Sep 13 '19 08:09 chintu-github

I am Communicating with appauth to present the browser in one of my viewcontroller present in my framework. As I am developing a framework, i don't have appdelegate.

chintu-github avatar Sep 13 '19 09:09 chintu-github

works for me with Xcode 11 GM Seed 2 (didn't work with GM Seed 1).

staffler-xyz avatar Sep 18 '19 13:09 staffler-xyz

The reason is because presentation context is deallocated. Try to use:

+ (id<OIDExternalUserAgentSession>)authStateByPresentingAuthorizationRequest:(OIDAuthorizationRequest *)authorizationRequest
                     presentingViewController:(UIViewController *)presentingViewController
                                     callback:(OIDAuthStateAuthorizationCallback)callback

I got same problem (also in framework), so I made sth like that:

- (void)loginWithPresentationContext:(UIViewController *)presentationContext

and i need to pass viewController to function

You can also get the most top view controller.

link

I made it on Xcode 11 MG Seed 1 and it works well, on Seed 2 also.

frogger111 avatar Sep 19 '19 06:09 frogger111

I have the same problem as chintu-github. I have new xcode 11. It's not beta version.

pakisha avatar Sep 23 '19 08:09 pakisha

I've experienced this issue using RN wrapper for this library after XCode upgrade to 11 on simulators with ios 13

mrruby avatar Sep 24 '19 08:09 mrruby

I am experiencing the same issue with Xcode 11 (not beta). I call the same method it was suggested in this thread:

self.currentAuthorizationSession = OIDAuthState.authState(byPresenting: request, presenting: viewController) { [weak self] authState, error in

If I fetch the code from branch ios13beta, it works. So the solution is implemented for sure. Do you have a timeline when will be that branch merged into master?

zoli-halcyon avatar Sep 27 '19 12:09 zoli-halcyon

The ios13beta code was merged in https://github.com/openid/AppAuth-iOS/pull/431 are you using version 1.2.0?

WilliamDenniss avatar Sep 27 '19 21:09 WilliamDenniss

Ah, it was 1.1.0. Thanks for pointing it out!

zoli-halcyon avatar Sep 30 '19 08:09 zoli-halcyon

We're still seeing this problem, on device. Running AppAuth 1.2.0, Xcode 11 and iOS 13.0.

Error Domain=org.openid.appauth.general Code=-3 "(null)" UserInfo={NSUnderlyingError=0x28160b720 {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.}}}

and i'm calling OIDAuthState.authState(byPresenting: authorizationRequest, presenting: presentingViewController) { [weak self] authState, error in

oslTrifork avatar Sep 30 '19 11:09 oslTrifork

I also have the same problem, when I click to login with Google, fails to show login browser. Running AppAuth 1.2.0, Xcode11 and iOS 13.0, iPhone XR. The strange thing is that can display it normally in the simulator, iOS13.0, iPhone XR.

And with the same code it works normally on AppAuth 1.2.0, Xcode11 and iOS 10.3.3, iPhone5.

Error message on Xcode console as follows Error Domain=com.google.GIDSignIn Code=-1 "The operation couldn’t be completed. (org.openid.appauth.general error -3.)" UserInfo={NSLocalizedDescription=The operation couldn’t be completed. (org.openid.appauth.general error -3.)}

corporale avatar Oct 09 '19 10:10 corporale

Any update on this issue? iOS 13 has been out for 3 weeks now.

vipmobile avatar Oct 16 '19 19:10 vipmobile

Hello everybody, any update about this issue? I still with the error using iOS 13 and AppAuth 1.2.0.

dammdev avatar Oct 23 '19 18:10 dammdev

FYI: After a bunch of testing on our side, it seems to be fixed if you delete your PODS folder and install the dependencies again.

We suspect that the problem is that the compiler ignores this macro __IPHONE_OS_VERSION_MAX_ALLOWED in OIDExternalUserAgentIOS.m, line 110. When we ran a debugger through that particular code, we noticed that it skipped the line, thus the contextProvider is never set, however after we deleted our PODS folder and installed from clean, it worked as expected.

Tested with Xcode 11.0 and 11.3

oslTrifork avatar Dec 18 '19 10:12 oslTrifork

Hello All,

I am facing the issue related to OIDC authentication popup. It does not appear often. I am getting Error Domain=org.openid.appauth.general Code=-3 "(null)" .

I am using - xCode version 11.3 iPhone 8 iOS 13 (latest version). AppAuth 1.3.0.

We are getting this issue only on iPhone 8

I have deleted the pods folder and installed the pods again. But this issue is still there. Please help me in this regard.

nikhil-atlogys avatar Mar 19 '20 12:03 nikhil-atlogys

Hello All,

I am facing the issue related to OIDC authentication popup. It does not appear often. I am getting Error Domain=org.openid.appauth.general Code=-3 "(null)" .

I am using - xCode version 11.3 iPhone 8 iOS 13 (latest version). AppAuth 1.3.0.

We are getting this issue only on iPhone 8

I have deleted the pods folder and installed the pods again. But this issue is still there. Please help me in this regard.

I am still waiting for the fix for this issue. Can someone help me with this?

nikhil-atlogys avatar May 20 '20 12:05 nikhil-atlogys

Is there any known solution to this? I have exactly the same issue you are describing here running AppAuth 1.2.0 wrapped into Resct Native on iOS 13.5.1 on an iPhone XS:

https://github.com/FormidableLabs/react-native-app-auth/issues/525

Deleting the pods folder and running pod install won’t help, unfortunately

Problem only appears on an actual device in release mode. In debug mode on the simulator it works as expected

the-smart-home-maker avatar Jul 07 '20 03:07 the-smart-home-maker

I was struggling with this issue for some time and I discovered that my faceID popup actually stays about a second longer after the callback is run. As a temporary workaround, I added a 1 sec delay before signInWithBrowser, just enough time for the FaceID popup to disappear. I guess the presenter you pass to signInWithBrowser must be the topmost view, which is not the case right after a faceID. I'm now looking for a way to detect when the FaceID popup disappeared.

fxmarquand avatar Aug 03 '20 14:08 fxmarquand

Hi all,

Any updates regarding this issue? We are facing the same problem. Our environment is:

Xcode: 11.3.1 AppAuth: 1.4.0 (although we have tested also with version 1.2.0 with the same result)

It seems that we might be running the same issue described by @oslTrifork here. Although removing the Pods directory and running a pod install again did not solve the issue.

Thank you in advance and please let me know if there is any other information that I could provide towards debugging this further.

cristiantanas avatar Aug 12 '20 14:08 cristiantanas

I was struggling with this issue for some time and I discovered that my faceID popup actually stays about a second longer after the callback is run. As a temporary workaround, I added a 1 sec delay before signInWithBrowser, just enough time for the FaceID popup to disappear. I guess the presenter you pass to signInWithBrowser must be the topmost view, which is not the case right after a faceID. I'm now looking for a way to detect when the FaceID popup disappeared.

Do you know if there is a bug raised for this on the Apple side?

simon-burrows-infinity avatar Aug 17 '20 08:08 simon-burrows-infinity

Same problem here. Building with Xcode 12 and AppAuth 1.4.0

Works on 5S running iOS 12.4.8, but fails on 6S running 14.0.1.

CrewNerd avatar Oct 08 '20 04:10 CrewNerd

I found a workaround, but I don't know if this will work for others. I found that moving one step up the view controller parent chain when passing in the presentingViewController solved the problem for me.

CrewNerd avatar Oct 09 '20 02:10 CrewNerd

Getting same problem in Xcode12 and AppAuth 1.4.0 Please help me out.

hiteshtrivedi avatar Nov 20 '20 11:11 hiteshtrivedi

Have you tried Tony's solution?

Le ven. 20 nov. 2020 à 12:09, Hitesh Trivedi [email protected] a écrit :

Getting same problem in Xcode12 and AppAuth 1.4.0 Please help me out.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/openid/AppAuth-iOS/issues/447#issuecomment-731105272, or unsubscribe https://github.com/notifications/unsubscribe-auth/APIJXZVWXAJEXZT7VDBLGMDSQZE6ZANCNFSM4IWNQFKQ .

fxmarquand avatar Nov 20 '20 11:11 fxmarquand

Yes, I found issue of redirection when going for Yahoo login

hiteshtrivedi avatar Nov 20 '20 15:11 hiteshtrivedi

@fxmarquand have you used the delay work-around successfully in production? For us it fixed the issue on our dev machine but we hesitate to use it.

Cooke avatar Aug 26 '21 14:08 Cooke

Yes it does work in production.

On Thu, Aug 26, 2021, 7:52 AM Henrik Cooke @.***> wrote:

@fxmarquand https://github.com/fxmarquand have you used the delay work-around successfully in production? For us it fixed the issue on our dev machine but we hesitate to use it.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/openid/AppAuth-iOS/issues/447#issuecomment-906483137, or unsubscribe https://github.com/notifications/unsubscribe-auth/APIJXZTBCDHPF7Z2F4635CTT6ZILZANCNFSM4IWNQFKQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

fxmarquand avatar Aug 26 '21 16:08 fxmarquand

I am also getting the same issue while logout

anujraghuvanshi avatar Sep 04 '22 21:09 anujraghuvanshi