openid / AppAuth-iOS

iOS and macOS SDK for communicating with OAuth 2.0 and OpenID Connect providers.
https://openid.github.io/AppAuth-iOS
Apache License 2.0
1.77k stars 773 forks source link

OIDAuthState.authState fails to show login browser on iOS 13 #447

Open chintu-github opened 5 years ago

chintu-github commented 5 years ago

HI Team,

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

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 commented 5 years ago

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.

staffler-xyz commented 5 years ago

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

frogger111 commented 5 years ago

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.

pakisha commented 5 years ago

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

mrruby commented 5 years ago

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

zoli-halcyon commented 5 years ago

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?

WilliamDenniss commented 5 years ago

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

zoli-halcyon commented 5 years ago

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

oslTrifork commented 5 years ago

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

corporale commented 5 years ago

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.)}

vipmobile commented 5 years ago

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

dammdev commented 5 years ago

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

oslTrifork commented 4 years ago

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

nikhil-atlogys commented 4 years ago

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 commented 4 years ago

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?

the-smart-home-maker commented 4 years ago

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

fxmarquand commented 4 years ago

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.

cristiantanas commented 4 years ago

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.

simon-burrows-infinity commented 4 years ago

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?

CrewNerd commented 4 years ago

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 commented 4 years ago

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.

hiteshtrivedi commented 3 years ago

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

fxmarquand commented 3 years ago

Have you tried Tony's solution?

Le ven. 20 nov. 2020 à 12:09, Hitesh Trivedi notifications@github.com 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 .

hiteshtrivedi commented 3 years ago

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

Cooke commented 3 years ago

@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.

fxmarquand commented 3 years ago

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 .

anujraghuvanshi commented 2 years ago

I am also getting the same issue while logout