Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASWebAuthenticationSession error when using GIDSignIn #3791

Closed
ajkolean opened this issue Sep 6, 2019 · 30 comments
Closed

ASWebAuthenticationSession error when using GIDSignIn #3791

ajkolean opened this issue Sep 6, 2019 · 30 comments
Assignees
Labels
Milestone

Comments

@ajkolean
Copy link

ajkolean commented Sep 6, 2019

[READ] Step 1: Are you in the right place?

YES

[REQUIRED] Step 2: Describe your environment

  • Xcode version: 11.0 beta 7
  • Firebase SDK version: 6.7.0
  • Firebase Component: Auth
  • Component version: 6.7.0

My Podfile.lock is

  - Firebase/Analytics (6.7.0):
    - Firebase/Core
  - Firebase/Auth (6.7.0):
    - Firebase/CoreOnly
    - FirebaseAuth (~> 6.2.3)
  - Firebase/Core (6.7.0):
    - Firebase/CoreOnly
    - FirebaseAnalytics (= 6.1.1)
  - Firebase/CoreOnly (6.7.0):
    - FirebaseCore (= 6.2.1)
  - Firebase/DynamicLinks (6.7.0):
    - Firebase/CoreOnly
    - FirebaseDynamicLinks (~> 4.0.3)
  - Firebase/Firestore (6.7.0):
    - Firebase/CoreOnly
    - FirebaseFirestore (~> 1.4.4)
  - Firebase/Functions (6.7.0):
    - Firebase/CoreOnly
    - FirebaseFunctions (~> 2.5.1)
  - Firebase/Messaging (6.7.0):
    - Firebase/CoreOnly
    - FirebaseMessaging (~> 4.1.3)
  - Firebase/Performance (6.7.0):
    - Firebase/CoreOnly
    - FirebasePerformance (~> 3.1.2)
  - Firebase/RemoteConfig (6.7.0):
    - Firebase/CoreOnly
    - FirebaseRemoteConfig (~> 4.3.0)
  - Firebase/Storage (6.7.0):
    - Firebase/CoreOnly
    - FirebaseStorage (~> 3.4.0)
  - FirebaseABTesting (3.1.0):
    - FirebaseAnalyticsInterop (~> 1.3)
    - FirebaseCore (~> 6.1)
    - Protobuf (~> 3.8)
  - FirebaseAnalytics (6.1.1):
    - FirebaseCore (~> 6.2)
    - FirebaseInstanceID (~> 4.2)
    - GoogleAppMeasurement (= 6.1.1)
    - GoogleUtilities/AppDelegateSwizzler (~> 6.0)
    - GoogleUtilities/MethodSwizzler (~> 6.0)
    - GoogleUtilities/Network (~> 6.0)
    - "GoogleUtilities/NSData+zlib (~> 6.0)"
    - nanopb (~> 0.3)
  - FirebaseAnalyticsInterop (1.4.0)
  - FirebaseAuth (6.2.3):
    - FirebaseAuthInterop (~> 1.0)
    - FirebaseCore (~> 6.2)
    - GoogleUtilities/AppDelegateSwizzler (~> 6.2)
    - GoogleUtilities/Environment (~> 6.2)
    - GTMSessionFetcher/Core (~> 1.1)
  - FirebaseAuthInterop (1.0.0)
  - FirebaseCore (6.2.1):
    - FirebaseCoreDiagnostics (~> 1.0)
    - FirebaseCoreDiagnosticsInterop (~> 1.0)
    - GoogleUtilities/Environment (~> 6.2)
    - GoogleUtilities/Logger (~> 6.2)
  - FirebaseCoreDiagnostics (1.0.1):
    - FirebaseCoreDiagnosticsInterop (~> 1.0)
    - GoogleDataTransportCCTSupport (~> 1.0)
    - GoogleUtilities/Environment (~> 6.2)
    - GoogleUtilities/Logger (~> 6.2)
  - FirebaseCoreDiagnosticsInterop (1.0.0)
  - FirebaseDynamicLinks (4.0.3):
    - FirebaseAnalyticsInterop (~> 1.3)
    - FirebaseCore (~> 6.2)
  - FirebaseFirestore (1.4.5):
    - FirebaseAuthInterop (~> 1.0)
    - FirebaseCore (~> 6.2)
    - FirebaseFirestore/abseil-cpp (= 1.4.5)
    - "gRPC-C++ (= 0.0.9)"
    - leveldb-library (~> 1.20)
    - nanopb (~> 0.3.901)
    - Protobuf (~> 3.1)
  - FirebaseFirestore/abseil-cpp (1.4.5):
    - FirebaseAuthInterop (~> 1.0)
    - FirebaseCore (~> 6.2)
    - "gRPC-C++ (= 0.0.9)"
    - leveldb-library (~> 1.20)
    - nanopb (~> 0.3.901)
    - Protobuf (~> 3.1)
  - FirebaseFunctions (2.5.1):
    - FirebaseAuthInterop (~> 1.0)
    - FirebaseCore (~> 6.0)
    - GTMSessionFetcher/Core (~> 1.1)
  - FirebaseInstanceID (4.2.3):
    - FirebaseCore (~> 6.0)
    - GoogleUtilities/Environment (~> 6.0)
    - GoogleUtilities/UserDefaults (~> 6.0)
  - FirebaseMessaging (4.1.3):
    - FirebaseAnalyticsInterop (~> 1.3)
    - FirebaseCore (~> 6.2)
    - FirebaseInstanceID (~> 4.1)
    - GoogleUtilities/AppDelegateSwizzler (~> 6.2)
    - GoogleUtilities/Environment (~> 6.2)
    - GoogleUtilities/Reachability (~> 6.2)
    - GoogleUtilities/UserDefaults (~> 6.2)
    - Protobuf (~> 3.1)
  - FirebasePerformance (3.1.2):
    - FirebaseCore (~> 6.2)
    - FirebaseInstanceID (~> 4.2)
    - FirebaseRemoteConfig (~> 4.2)
    - GoogleToolboxForMac/Logger (~> 2.1)
    - "GoogleToolboxForMac/NSData+zlib (~> 2.1)"
    - GoogleUtilities/Environment (~> 6.0)
    - GoogleUtilities/ISASwizzler (~> 6.0)
    - GoogleUtilities/MethodSwizzler (~> 6.0)
    - GTMSessionFetcher/Core (~> 1.1)
    - Protobuf (~> 3.5)
  - FirebaseRemoteConfig (4.3.0):
    - FirebaseABTesting (~> 3.1)
    - FirebaseAnalyticsInterop (~> 1.4)
    - FirebaseCore (~> 6.2)
    - FirebaseInstanceID (~> 4.2)
    - GoogleUtilities/Environment (~> 6.0)
    - "GoogleUtilities/NSData+zlib (~> 6.0)"
    - Protobuf (~> 3.5)
  - FirebaseStorage (3.4.0):
    - FirebaseAuthInterop (~> 1.0)
    - FirebaseCore (~> 6.0)
    - GTMSessionFetcher/Core (~> 1.1)```

[REQUIRED] Step 3: Describe the problem

Trying to sign in with Google causes crash.

 NSError    domain: "com.google.GIDSignIn" - code: 18446744073709551615    0x0000000283cd0390
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.)}
@morganchen12
Copy link
Contributor

Can you share the stack trace of the crash? The error log at the bottom is a non-fatal error.

@jlaws
Copy link

jlaws commented Sep 10, 2019

@morganchen12 it does not crash for us, it just fails with the error posted above.

@ajkolean
Copy link
Author

ajkolean commented Sep 11, 2019

Yes my mistake the error is being called in func sign( _ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!, withError error: Error!) with the above set as the error.

More on the error:
Error Domain=org.openid.appauth.general Code=-3 "(null)" UserInfo={NSUnderlyingError=0x6000007cf240 {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.}}} /*! @abstract Provides context to target where in an application's UI the authorization view should be shown. A provider must be set prior to calling -start, otherwise the authorization view cannot be displayed. If deploying to iOS prior to 13.0, the desired window is inferred by the application's key window. */ @property (nonatomic, weak) id <ASWebAuthenticationPresentationContextProviding> presentationContextProvider API_AVAILABLE(ios(13.0), macos(10.15));

line 90 of OIDExternalUserAgentIOS.m
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.}
Investigating OIDExternalUserAgentIOS.m more it looks like something must have changed in apple's framework and _presentingViewController.view.window is now returning nil. UIWindow from a view is returning nil even when the VC is on the screen. Updating the return statement on line 239 to return the sharedWindow resolves the issue.

- (ASPresentationAnchor)presentationAnchorForWebAuthenticationSession:(ASWebAuthenticationSession *)session API_AVAILABLE(ios(13.0)){ return _presentingViewController.view.window; }

However, this code isn't ideal. OIDExternalUserAgentIOS should ask for a window rather than trying to derive it from the ViewController that is provided.

@morganchen12 morganchen12 changed the title Crash when using GIDSignIn ASWebAuthenticationSession error when using GIDSignIn Sep 11, 2019
@morganchen12
Copy link
Contributor

@renkelvin based on the error posted above it looks like we're misusing AuthenticationServices. Can you investigate?

@renkelvin
Copy link
Contributor

@morganchen12 Firebase Auth doesn't depend on AuthenticationServices. It seems an issue with GSI.

@morganchen12
Copy link
Contributor

Looks like this was reported earlier at b/139778942 (Google-internal only).

@paulb777
Copy link
Member

@morganchen12 b/139778942 should only impact binary installs. If the same thing is happening from a CocoaPods install, it's another issue.

@ajkolean Please confirm that you're using the most recent version of GoogleSignIn - 5.x

@ajkolean
Copy link
Author

ajkolean commented Sep 12, 2019

Yes I am, this is from my Podfile.lock:

- GoogleSignIn (5.0.0): - AppAuth (~> 1.1) - GTMAppAuth (~> 1.0) - GTMSessionFetcher/Core (~> 1.1)

@renkelvin
Copy link
Contributor

There is a compatibility issue with AppAuth 1.1.0 openid/AppAuth-iOS@d16caab
GoogleSignIn gonna release a new version with AppAuth 1.2.0 which will fix this issue.

@nndb05123
Copy link

how to fixed ???? :(

@renkelvin
Copy link
Contributor

You'll get AppAuth 1.2.0 now if using CocoaPods, which should fixed this issue.

@paulb777 paulb777 closed this as completed Oct 2, 2019
@tkrajacic
Copy link

Why is this issue closed? There is still no new binary release which fixes the issue.
Using Cocoapods is not a viable solution for many users, so this is still broken in the latest binary release here: https://developers.google.com/identity/sign-in/ios/sdk/

@paulb777 paulb777 added this to the 6.10.0 milestone Oct 2, 2019
@paulb777
Copy link
Member

paulb777 commented Oct 2, 2019

@tkrajacic Good point. Thanks!

This issue was missing a milestone. I've updated the issue to include the 6.10.0 milestone which is stabilizing now and should publish next week for CocoaPods, Carthage, and the Firebase binary release. I can't speak for the GoogleSignIn releases.

Our policy in this repo is to close issues when they're fixed in source and do release tracking based on the associated milestone.

@apprme
Copy link

apprme commented Oct 9, 2019

Even after release of 6_10_0 we still do observe the same behaiour on devices running iOS 13.

After invoking [[GIDSignIn sharedInstance] signIn] with GoogleSignIn framework from Firebase binary distribution we see "The app" wants to use google.com to signin" modal dialog that appears briefly and then hides itself and that's it.

@paulb777
Copy link
Member

paulb777 commented Oct 9, 2019

@vetrovosk Please confirm that you updated the AppAuth.framework to the version 1.2.0 from the zip download, did a clean rebuild, and removed DerivedData(rm -rf ~/Library/Developer/Xcode/DerivedData/)

@apprme
Copy link

apprme commented Oct 9, 2019

Yes, I confirm that I've just made a fresh clone of google signin sample app, opened it in Xcode 11, changed client id in app delegate, changed CFBundleURLTypes in Info.plist accordingly, added -ObjC linker flag, and dragged and dropped all the frameworks from Firebase/GoogleSignIn/ and Firebase/GoogleSignIn/Resources/GoogleSignIn.bundle into the project (with "Copy items if needed" checkbox checked).

I've also removed ~/Library/Developer/Xcode/DerivedData/.

I also observe that files inside zip distribution are dated with Oct 4 and GoogleSignIn: Mach-O universal binary with 4 architectures is built with ios sdk version 12.2.

Here is the sample application output:

2019-10-09 16:00:41.798270+0200 SignInExample[2010:37335] The user has not signed in before or they have since signed out.
2019-10-09 16:00:43.467469+0200 SignInExample[2010:37335] The operation couldn’t be completed. (org.openid.appauth.general error -3.)
2019-10-09 16:00:43.928864+0200 SignInExample[2010:37335] [Warning] Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior (<SFAuthenticationViewController: 0x7fc3de036c00>)

@paulb777 paulb777 reopened this Oct 9, 2019
@paulb777
Copy link
Member

paulb777 commented Oct 9, 2019

Thanks @vetrovosk.

It looks like the AppAuth fix doesn't get applied in our Xcode 10.1 built binary release distributions.

We'll investigate solutions. In the meantime, the workaround would be to integrate the AppAuth source or rebuild a binary framework with Xcode 11.

@apprme
Copy link

apprme commented Oct 9, 2019

Yes, I even think that I've mentioned that their fix uses compile time checks that don't get applied when built against older versions of ios sdk in the support Case 00011522 submitted to [email protected] :-)

Thanks!

@paulb777
Copy link
Member

According to the GoogleSignIn team, the 5.0.1 zip file downloadable from https://developers.google.com/identity/sign-in/ios/sdk has the fix.

I'll leave this issue open until we have a resolution for the Firebase zip and Carthage distribution.

@paulb777 paulb777 added Carthage zip-builder Tools related to building the zip file. labels Oct 10, 2019
@NathanWalker
Copy link

Is anyone still running into this issue with latest Firebase 6.10.0? Seems still occurs - perhaps that's what you're referring to @paulb777 that everyone still waiting on full resolution in Firebase ditro? Perhaps in a 6.11.0 upcoming release?

@paulb777
Copy link
Member

@NathanWalker We don't have a mechanism in Firebase to support different binaries for both Xcode 10 and Xcode 11, so we're planning to drop distribution of the GoogleSignIn binary and instead reference the GoogleSignIn team's official distribution channel at https://developers.google.com/identity/sign-in/ios/sdk

@apprme
Copy link

apprme commented Oct 15, 2019

@paulb777 when we try to use GoogleSignIn SDK instead of Firebase/GoogleSignIn/ together with the rest of Firebase SDK v6.10.0 (zip file distribution) (we use Firebase/Analytics, Firebase/Performance and Crashlytics) our Xcode build fails with a lot of the errors like these:

duplicate symbol '_OBJC_IVAR_$_GTMSessionFetcherService._userAgent' in:
    ..//../delightex-statistics-moe/build/SDK/Firebase/Performance/GTMSessionFetcher.framework/GTMSessionFetcher(GTMSessionFetcherService.o)
    ..//../delightex-statistics-moe/build/SDK/GoogleSignIn/GoogleSignInDependencies.framework/GoogleSignInDependencies(GTMSessionFetcherService_2e227824097119dae0a3dbbaed733920.o)
duplicate symbol '_OBJC_IVAR_$_GTMSessionFetcherService._allowInvalidServerCertificates' in:
    ..//../delightex-statistics-moe/build/SDK/Firebase/Performance/GTMSessionFetcher.framework/GTMSessionFetcher(GTMSessionFetcherService.o)
    ..//../delightex-statistics-moe/build/SDK/GoogleSignIn/GoogleSignInDependencies.framework/GoogleSignInDependencies(GTMSessionFetcherService_2e227824097119dae0a3dbbaed733920.o)
duplicate symbol '_OBJC_IVAR_$_GTMSessionFetcherService._allowedInsecureSchemes' in:
    ..//../delightex-statistics-moe/build/SDK/Firebase/Performance/GTMSessionFetcher.framework/GTMSessionFetcher(GTMSessionFetcherService.o)
    ..//../delightex-statistics-moe/build/SDK/GoogleSignIn/GoogleSignInDependencies.framework/GoogleSignInDependencies(GTMSessionFetcherService_2e227824097119dae0a3dbbaed733920.o)
duplicate symbol '_OBJC_IVAR_$_GTMSessionFetcherService._properties' in:
    ..//../delightex-statistics-moe/build/SDK/Firebase/Performance/GTMSessionFetcher.framework/GTMSessionFetcher(GTMSessionFetcherService.o)
    ..//../delightex-statistics-moe/build/SDK/GoogleSignIn/GoogleSignInDependencies.framework/GoogleSignInDependencies(GTMSessionFetcherService_2e227824097119dae0a3dbbaed733920.o)
duplicate symbol '_OBJC_IVAR_$_GTMSessionFetcherService._stoppedFetchersToWaitFor' in:
    ..//../delightex-statistics-moe/build/SDK/Firebase/Performance/GTMSessionFetcher.framework/GTMSessionFetcher(GTMSessionFetcherService.o)
    ..//../delightex-statistics-moe/build/SDK/GoogleSignIn/GoogleSignInDependencies.framework/GoogleSignInDependencies(GTMSessionFetcherService_2e227824097119dae0a3dbbaed733920.o)
duplicate symbol '_OBJC_IVAR_$_GTMSessionFetcherService._authorizer' in:
    ..//../delightex-statistics-moe/build/SDK/Firebase/Performance/GTMSessionFetcher.framework/GTMSessionFetcher(GTMSessionFetcherService.o)
    ..//../delightex-statistics-moe/build/SDK/GoogleSignIn/GoogleSignInDependencies.framework/GoogleSignInDependencies(GTMSessionFetcherService_2e227824097119dae0a3dbbaed733920.o)
duplicate symbol '_OBJC_IVAR_$_GTMSessionFetcherSessionDelegateDispatcher._discardTimer' in:
    ..//../delightex-statistics-moe/build/SDK/Firebase/Performance/GTMSessionFetcher.framework/GTMSessionFetcher(GTMSessionFetcherService.o)
    ..//../delightex-statistics-moe/build/SDK/GoogleSignIn/GoogleSignInDependencies.framework/GoogleSignInDependencies(GTMSessionFetcherService_2e227824097119dae0a3dbbaed733920.o)

@paulb777
Copy link
Member

Thanks for the report @vetrovosk

A likely workaround would be to stop linking the GTMSessionFetcher.framework from Firebase.

@peteyblah
Copy link

I'm still having this issue, any timeframe for when this might be fixed? Thanks.

@paulb777 paulb777 modified the milestones: 6.10.0, M59 Oct 17, 2019
@paulb777
Copy link
Member

@peteyblah To summarize, the issue is fixed for CocoaPods users. For binary distro users, you need to use one of the workarounds discussed above. We're targeting a binary distribution solution for the M59 release, which is roughly three weeks from now.

@peteyblah
Copy link

I've read through the thread, I've tried using the package from the GoogleSignIn team with the 5.0.1 zip, but end up having the same error as mentioned above (even after a clean build and clearing derived data), that I get with the complete Firebase package.

@paulb777
Copy link
Member

paulb777 commented Nov 6, 2019

This should be fixed in today's Firebase 6.12.0 in which the zip and Carthage distros are built with Xcode 11 instead of Xcode 10.

cc: @maksymmalyhin

@paulb777 paulb777 closed this as completed Nov 6, 2019
@olejnjak
Copy link

olejnjak commented Nov 6, 2019

I'm afraid that I'm experiencing the same issue even with 6.12.0 release. Calling GIDSignIn.shared.signIn() almost immediately fails with error The operation couldn’t be completed. (org.openid.appauth.general error -3.)

@paulb777
Copy link
Member

paulb777 commented Nov 6, 2019

@olejnjak Thanks for the report and sorry about that.

It turns out we had a problem with the release scripting and that the Carthage distribution was still built with Xcode 10. We plan to fix in the next release.

In the meantime, a workaround for Carthage users is to use GoogleSignIn.framework from the zip distribution.

@paulb777 paulb777 reopened this Nov 6, 2019
@paulb777 paulb777 modified the milestones: 6.12.0, M60 Nov 6, 2019
@ryanwilson
Copy link
Member

Firebase 6.13.0 was published to Carthage moments ago and was packaged with Xcode 11. This should be resolved now, please re-open if you still run into issues.

@firebase firebase locked and limited conversation to collaborators Dec 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.