Facebook Sign-in UI Fails on iOS 13 / Xcode 11 (AWSMobileClient.default().showSignIn) Facebook SDK 5.8 required. #1974
Labels
mobile client
Issues related to AWSMobileClient
work in progress
Issues was triaged and investigation done
Describe the bug
FBSDK 4.42 does not support iOS 13. iOS 13 requires
ASWebAuthenticationPresentationContextProviding
which was added in FBSDKCoreKit/FBSDKCoreKit/Internal/BridgeAPI/FBSDKBridgeAPI.m in 5.4.0After upgrading from Xcode10 to Xcode11 and iOS 13, the Facebook login button no longer works on the AWSMobileClient sign in screen. When the button is pushed, an error is returned then the showSignIn() returns nil. Error:
-canOpenURL: failed for URL: "fbauth2:/" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"
Facebook is not installed in the simulator but was installed on physical device. In either case, the same error log returns and the Facebook sign-in does not appear. If the user is already singed-in to the app via Facebook and there is a valid token, then the app will login the user (just indicating that the problem is with the sign-in UI)This problem is resolved by upgrading to the latest FBSDKs. FBSDKCoreKit must implement
ASWebAuthenticationPresentationContextProviding
which was resolved byfacebook/facebook-ios-sdk@6b06109#diff-72593591275d63edfb1bfad837e4c32f
WORKAROUND: I implemented the changes manually in 4.42 to add ASWebAuthenticationPresentationContextProviding in @interface FBSDKBridgeAPI() <FBSDKApplicationObserving, FBSDKContainerViewControllerDelegate, ASWebAuthenticationPresentationContextProviding> and it works now. This confirms that this is a bug that should affect everyone attempting to use aws-sdk-ios AWSAuthUI with Facebook.
To Reproduce
Steps to reproduce the behavior:
AWSMobileClient.default().signOut();
Which AWS service(s) are affected?
AWSMobileClient
AWSAuthUI
AWSAuthCore
Environment(please complete the following information):
Device Information (please complete the following information):
Info.plist contains the correct settings for Facebook
The Info.plist contains fbauth2 (and it works in iOS version < 13) with the same code.
Fails at AWSFacebookSignInProvider self.facebookLogin
FBSDK returns
UserInfo={message=User Cancelled Login}
AWSFacebookSignInProvider: line 180 (2.11.1)
FBSDKLoginManager detects that the Facebook app is not installed (when running in the simulator) and attempts to login using the safari browser
FBSDK creates the authURL: authURL as
@"https://m.facebook.com/v3.2/dialog/oauth?auth_type=rerequest&client_id=...&default_audience=friends&display=touch&e2e=%7B%22init%22%...%7D&fbapp_pres=0&redirect_uri=...%3A%2F%2Fauthorize%2F&response_type=token%2Csigned_request&return_scopes=true&scope=public_profile&sdk=ios&sdk_version=4.42.0&state=%7B%22challenge...
[[FBSDKBridgeAPI sharedInstance] openURLWithSafariViewController:authURL sender:self fromViewController:self.fromViewController handler:handlerWrapper];
returns error to handler : `anError NSError * domain: @"com.apple.AuthenticationServices.WebAuthenticationSession" - code: 2 0x000060400014b790```
resulting in facebook returning to AWSFacebookSignInProvier an indication that
UserInfo={message=User Cancelled Login}
, which the user did not cancel the login.What happened is that the OS needs the window to display the OAuth Alert and Web login flow. To do that, ASWebAuthenticationSession needs to know which window is presenting the OAuth request by implementing the ASWebAuthenticationPresentationContextProviding interface in your presenting View Controller.
The text was updated successfully, but these errors were encountered: