ios app rejected on using AWS cognito implementation from mobile hub - facebook

We recently got our ios app rejected because of the following:
We noticed that the user is taken to Safari to sign in or register for an account, which provides a poor user experience.
however, the bit that launches the safari window for facebook/Google login is part of the AWSMobileHubHelper framework so we can't modify that code.
Any ideas/solutions would be greatly appreciated.

So I found a workaround. I just grab the GIDSignIn instance and change the properties myself. In case any one else wants to know how, all you have to do is:
Add a bridge header and import #import <GoogleSignIn/GoogleSignIn.h>
Implement the presentViewController method for GIDSignInUIDelegate on your main login controller
func signIn(signIn: GIDSignIn!, presentViewController viewController: UIViewController!) {
presentViewController(viewController, animated: true, completion: nil)
}
Edit demo login code to be something like this:
func loginWithGoogle(delegate: GIDSignInUIDelegate!) {
let googleProvider = AWSGoogleSignInProvider.sharedInstance()
// It is important that these are initialized after
// AWSGoogleSignInProvider.sharedInstance() is called
GIDSignIn.sharedInstance().uiDelegate = delegate
GIDSignIn.sharedInstance().allowsSignInWithBrowser = false
GIDSignIn.sharedInstance().allowsSignInWithWebView = true
handleLoginWithSignInProvider(googleProvider, callback: callback)
}

As of iOS 9 using Facebook SDK, this is expected behavior per Facebook login. Mobile Hub quickstart app is just applying the Facebook SDK 3 and using the APIs as directed. Check out the brief description below and read through the comments to get a better insight. This was not a popular decision by Facebook and others have provided workarounds (to forcing user authentication via mobile browser) if you wish to experiment. As for the AWSMobileHubHelper framework, we are looking into making this available at some point but don't have a timeline for this.
"Logic that automatically defaults people to the optimum experience for iOS 9. This means that the SDK dialogs for Facebook Login, Sharing across Facebook and Messenger, App Invites, App Events, or Native Like will automatically determine the best experience for people based on their device."
Source:
https://developers.facebook.com/blog/post/2015/09/10/new-SDK-for-iOS9/

Related

Gigya swift sdk login with social providers getting issue: [facebook] can't login with WebView, install related sdk

Gigya.sharedInstance().showScreenSet(with:"Store-RegistrationLogin", viewController: self) { result in
switch result {
case .onLogin(let account):
// onLogin event
print("onLoginaccount-->",account)
case .error(let event):
// error event
print("error-->",event)
case .onAfterValidation(event: let event):
print("onAfterValidation")
case .onCanceled:
print("onCanceled")
}
}
i am using above code Gigya screen set is loaded and Normal registration and login working fine but when i click on the Social providers App crash i am getting below issue
[facebook] can't login with WebView, install related sdk. curently i am using xcode 13.1 and swift 5
Please help me #thanks
Firstable following the instruction from Facebook:
https://developers.facebook.com/docs/ios/getting-started/
once you have it works, following our instructions:
https://sap.github.io/gigya-swift-sdk/GigyaSwift/#facebook
You can find our providers wrappers here:
https://github.com/SAP/gigya-swift-sdk/releases/tag/core%2Fv1.3.1
Do not forget to configurate your provider in your console:
https://help.sap.com/docs/SAP_CUSTOMER_DATA_CLOUD/8b8d6fffe113457094a17701f63e3d6a/5ff3bc8174da4542a61d03033af4877d.html
Adding Facebook native login to your iOS app is mandatory if you want to login via Facebook. https://sap.github.io/gigya-swift-sdk/GigyaSwift/#facebook

CallKit :- Callkit is working but the callee doesn't get the call

I want to develop an SOS application. When I am trying to use URL schema openURL(), it will display an alert but my requirement is to connect the call without any alert or popup while trying to call. So I found a solution using CallKit. When I implemented CallKit in my application it does not ask for any permission, the outgoing call is placed but the callee doesn't get any call. Is there any solution for this?
I have tried the following code for connecting the call.
#IBAction func buttonCallTapped(_ sender: Any) {
let provider = CXProvider(configuration: CXProviderConfiguration(localizedName: "My App"))
provider.setDelegate(self, queue: nil)
let controller = CXCallController()
let transaction = CXTransaction(action: CXStartCallAction(call: UUID(), handle: CXHandle(type: .phoneNumber, value: "\(number)")))
controller.request(transaction, completion: { error in })
DispatchQueue.main.asyncAfter(wallDeadline: DispatchWallTime.now() + 5) {
provider.reportOutgoingCall(with: controller.callObserver.calls[0].uuid, connectedAt: nil)
}
}
You just can't make standard native calls through CallKit. The CallKit framework, as clearly stated in the documentation, is meant to be used to develop custom VoIP applications and integrate them with the native phone interface.
Any iOS application can't make native call without user action.
An alert will be shown with phone number and two buttons will be available "Call" and "Cancel" which is presented from the OS level.
Just like we are showing popup to delete photos from Photos app.
Solution
If you want to implement SOS Application (Yes its possible using VoIP
service), But you can place calls when app is active (Can be done
without user action given internet connection is there.)
Note: The receiving side also should support VoIP.
How to Implement VoIP
We need permission of Voice over IP services to make calls in between iPhone devices.
VoIP app must have background mode enabled in the Xcode Project >
Capabilities pane. Select the checkbox for Voice over IP
Also CallKit is indented only for VoIP Apps, If you really want to implement the VoIP follow CallKit Tutorial

Default FBSDKLoginBehavior.Native not working on iOS 9

I just upgraded my app to Xcode 7 / Swift 2.0 and I'm struggling with the Facebook Login via AppSwitch. I'm on the latest FBSDK (4.6) and did everything according to the upgrade guide. Still, on iOS9 the Facebook login happens via in-app browser, the appswitch doesn't work anymore. I also tried force setting the loginbehavior but without luck:
let manager = FBSDKLoginManager()
manager.loginBehavior = FBSDKLoginBehavior.Native
manager.logInWithReadPermissions(facebookReadPermissions, fromViewController: nil, handler: { (loginResult, error) -> Void in
Is there anything I can do to make appswitch work again?
Thanks!
Turns out that this is not an issue but the new desired behavior according to these posts from Facebook:
https://developers.facebook.com/bugs/1636969533209725/?comment_id=1011596265571252
This behavior is by design. In our latest iOS SDKs, the login behavior is now controlled on the server side in order to ensure the best user experience.
https://developers.facebook.com/bugs/786729821439894/?comment_id=1467419033584031
Because of introduced changes in iOS 9, This new behavior avoids the user to be asked if they want to go and open the Facebook Application, accept the permissions/share/etc, and then ask once more if they want to switch back to your app.
https://developers.facebook.com/bugs/1390559277910338/?comment_id=1661064587442645
System authentication doesn't give people control over the information they share with apps. And in iOS 9, fast-app-switching to the Facebook native app results in additional dialogs ("ExampleApp would like to open Facebook") which appear twice - once on the way from ExampleApp to Facebook, and once again on the return journey. We believe the default SDK behavior in v4.6 on iOS 9 offers the best experience to people logging into your app with Facebook.
You can patch FacebookSDK source code to use Fast App Switching.
The interesting part (for tag 4.6) is in file FBSDKCoreKit/Internal/ServerConfiguration/FBSDKServerConfigurationManager.m
+ (FBSDKServerConfiguration *)_defaultServerConfigurationForAppID:(NSString *)appID
{
…
BOOL useNativeFlow = ![FBSDKInternalUtility isOSRunTimeVersionAtLeast:iOS9Version];
As you can see, it disables native flow on iOS9+.
Changing the line to something like BOOL useNativeFlow = YES; should work.
P.S. I didn't check this patch myself yet.

facebook login give me already authorized this app without automatic returning to the app

My app should implement login with facebook but I have noticed that every time I want to login the facebook tell me you are already authorize this app , the question if I already authorized the app the facebook should return automatically without pressing the okey button as I saw in other applications ?
see the attached image
I fixed my problem by doing the following steps :
1- login to your facebook as admin to your app.
2- go to https://developers.facebook.com/apps/YOUR_FACEBOOK_APP_ID/summary.
3- go to settings > basic > Native IOS app
4- set the Configured for iOS SSO: to enabled
In iOS/Android the FBAccessToken's expiration time is up to 60 days. When you do FBLogin in your app you get the access token. once you get the token you should not do login again(otherwise you will be prompted already authorized this app since your app has already been given an access token earlier which is not expired ). You should reuse the unexpired access token.
Like this :
if FBSDKAccessToken.currentAccessToken() != nil {
print(FBSDKAccessToken.currentAccessToken().userID)
print(currentAccessToken().tokenString)
//OR call the *FBGraphRequest*
}
Note: for in-App browser login (SVC: Safari View Controller)
see more:
https://developers.facebook.com/blog/post/2015/10/29/Facebook-Login-iOS9/
and
https://developers.facebook.com/docs/reference/ios/4.9/class/FBSDKLoginManager/
You need to make sure that your app has the proper URL Prefix in your Build Settings. Also make sure that the URL Prefix matches your Facebook ID/URL Prefix in the Facebook developer app.
Edit: Your issue is probably that the access_token is expiring so it's have to re-ask for permissions.
This will happen if your application did not request offline_access permissions. In the newer SDK offline_access is deprecated and you now have to extend the access_token.
See this link: https://developers.facebook.com/docs/mobile/ios/build/#extend_token
As this Question is already answered , but i would like to add another helpful answer for Swift 3.0 :
While using FB Login in Swift , i having issue and i previously did this way:
let fbLoginManager : FBSDKLoginManager = FBSDKLoginManager()
fbLoginManager.loginBehavior = .systemAccount
As this uses , System account to check user is authorized for login or not . Unless you logout and login through different user , application shows same "Already authorized" message in place of Fresh login . So i used this way and this trick does the work :
let fbLoginManager : FBSDKLoginManager = FBSDKLoginManager()
fbLoginManager.loginBehavior = .web.
This show Login Screen after logout.
Hope this helps to solve this issue.
Feel free to comment . Thanks.
You should check if there is a current session before logging in with FBSDKLoginManager. Do not use [loginManager logout] before logging in.
if ([FBSDKAccessToken currentAccessToken])
{
NSLog(#"Token is available : %#",[[FBSDKAccessToken currentAccessToken]tokenString]);
// Now get details using graphpath.
} else {
// login with permissions using FBSDKLoginManager and get details using graphpath in completion
}
There is a open bug at facebook.com
https://developers.facebook.com/bugs/190389531089978
But the bug only appears at android, ios works fine.
(btw. same behavior in the foursquare and spotify android app - check it out)
Run your iOS FB application into device not simulator it works fine, and didn't shows the already authorized screen.
Thank you.

iphone facebook session failing. why?

I'm learning how to integrate facebook api in iphone app.
First I visited facebook website, went to applications->developer and created an app. Noted down private key and secret key.
Now, I'm using FBConnect sample code. I am using my keys in FBConnect app. And I set session proxy as
static NSString* kGetSessionProxy = #"SessionViewController"; // #"<YOUR SESSION CALLBACK)>";
I'm able to run the app and when I click "Connect to Facebook", its asking me for credentials as well. But afte providing credentials, its failing. The following delegate method is being called:
- (void)sessionDidNotLogin:(FBSession*)session { _label.text = #"Canceled login"; }
I'm not understanding why I'm ending up in above delegate.
What are all options that I've to select in facebook website when creating new application?
Please help me.
When I made kGetSessionProxy to nil, it worked without any problem. But I didn't understand why it didn't when i gave some value.