I'm using this package for Facebook OAuth:
https://www.npmjs.com/package/react-native-facebook-login
If I use FBLoginManager.LoginBehaviors.SystemAccount, when the user taps the Facebook login button, iOS will pop up a dialog asking if they want to grant access to the app. While this is convenient, the only drawback I've noticed is that I can ask for a dozen different permissions and the user has no clue what my app is requesting, nor can they selectively choose what to share.
Is there some way to give them this choice using the native iOS Facebook account? Or should I just use FBLoginManager.LoginBehaviors.Native which pops up an in-app browser for them to authenticate. (I was under the impression, according to the documentation, that it would switch to the Facebook app, but that doesn't happen)
The native iOS implementation (the one built by Apple) does not support the granular permission dialog you will see when doing login through the native Facebook app or the Safari View Controller flow so your only option is to fallback to any login method that does not involve the native OS implementation.
Related
App submissions to the app store which contain social logins are required to have a manual log in form along side the other logins (I am assuming this incase the 3rd party SDKs break then the user still has a method to log in).
Since apple have released their native 'Sign in with apple' capability (WWDC 2019) does this mean we can submit apps without a manual form? or will this still be a requirement?
I cannot find anything in the documentation to suggest either way.
The requirement is only if your app have social network login (Facebook, Google).
If your app uses a build in login (user/password), you don't need to implement.
In simple words, if your app is...
NOT USING THIRD PARTY LOGIN
If your app is not using any Third party login services then you do not need to implement login with Apple feature in your app.
USING NATIVE SIGN-IN/SIGNUP
If your app is using native sign-in/sign-up for user(user fill registration form and then login), then also you do not need to implement login with Apple in your app
USING THIRD PARTY LOGIN
If your app is using third party login Services like Facebook login, google login, Twitter login, etc. then You have to implement Sign in With Apple in your app.
USING THIRTY PARTY LOGIN + NATIVE SIGN-IN/SIGNUP(MIXED APPROACH)
If your app allows user to sign up via email by filling a registration form and also offers third party login then your app must implement Sign in with Apple.
So I've searched for this topic a lot and may be over complicating things but would love some clarity on it. So here's the issue.
I have a web app that uses Facebook Graph (FB Login, friends invite, sharing through FB, etc). We've just built an iOS app for the website and now want to implement all the above FB actions on the iOS app as well. I looked up the Facebook documentation and have tried using that to getting just the Facebook login to work for a user that's already registered on our website (and has their Facebook account connected as well) but it doesn't seem to work.
Use case - A user registers on the web app and connects their FB account with us. They then download the iOS app and want to use FB login to login to the iOS app or share objects on their timeline. A vice versa case should also apply.
Question - What should be the workflow between the ios App, web Server and Facebook for the use case above? Basically, how is the token and the secret passed so all three know we're talking about the same user and same FB account?
Any links or advice would be highly appreciated! Thanks!
In the case when a facebook authed webapp user first starts the native app, you won't know who they are. So they need to be prompted with a "login with facebook" button. When they hit that button, the facebook-ios-sdk will figure out who the logged in user is and then check if that user has already granted your application access. If the web app and the native app both point to the same facebook app, then the facebook-ios-sdk will simply store the authed access token, and you'll have access to everything your web app does on the native app.
The key here is that your web app and native app must point to the same facebook app (ie. same app id in developers.facebook.com). If it didn't, then the native app user would be re-prompted to grant permissions when they click the "login with facebook" button. Additionally, it's important that the user is logged into the same facebook account on the web app (which is based on cookies in the browser) and on the phone itself. The facebook-ios-sdk uses a couple of different ways to look for the active facebook account on the phone. It tries the iOS 5+ system facebook account, inter-app calls to facebook's own native app, the browser cookie for the web view instance running in your app, or bounce you out to safari and use the browser cookie in safari. Which ever one comes back first saying they have an active facebook account needs to have found the same facebook account as the one on the web app. In most cases, they will match up because most users only have a single facebook account and are logged in everywhere with the same account, but they certainly can be different. In the off chance that the web app facebook user is not the same as the native app active facebook user as detected by facebook-ios-sdk, then the "login with facebook" button will simply prompt the native app active facebook user to log in and grant permissions.
Once the access token has been granted to the native app, you can send it back to the server, find the associated facebook user id, and now the web app user and the native app user can be linked to be the same person operating both apps. Additionally, any graph api calls you want to make on the server can be made on behalf of the user using the up-to-date access token you just got from the native app. Any sharing/posting/api calls made directly in the native app through the facebook-ios-sdk will be done as this user and will be handled by the sdk (ie. you won't need to worry about it... it should just work seamlessly and integrate all posts to their timeline just like the web app's graph apis can).
In the case where you have a facebook authed native app user going to the web app, you also won't know (on the first request) who this user is. You can present them with a facebook js sdk login and, again, once the same facebook user logs in, you can associate this current web app user as the one who was on the native app earlier.
Specifically addressing your question, you really have no way of knowing who a migrating user is on either the web app or the native app when they first come to the app. That's where the "login with facebook" comes in. Assuming the user is logged into the same account on the browser as well as on their phone (as determined by the facebook-ios-sdk), then the process of logging into your app is seamless. They won't be prompted to grant permissions a second time (unless your permissions set is different between the web app and the native app) and you'll be given the user's access token immediately. The role of the server is to reconcile the two users by using the granted access token. With the access token, the server can make a simple call to the graph api and get the user's facebook user id. Using that facebook user id, you'll be able to match up the "true" identities of the users on your apps (ie. you now know that the web app user and the native app user are one and the same). Once you know who the user is, you'll be able to provide a personalized experience to that user, based on his identity, regardless of whether he's using your web app or your native app.
Hope this helps. Happy to answer more questions that you may have.
Right now I'm using a Facebook SDK to share posts from my application. The problem is that this sdk pops up a webview inside my app and asks the user to log in. There has to be a better way.
Can I send the share information to the facebook app on the users device (If they have it installed)? Or at least leverage the facebook app to check credentials? If people have to sign in to share, they probably won't do it..
The latest Facebook SDK 3.5 includes a native share dialog. If you follow the authentication workflow according do the documentation and the phone is on iOS 6.0 you should not get a UIWebView during authentication, instead you will get a UIAlertView.
Facebook login process would use WebView only in a few cases. Some of them are:
1) You are asking it to do so explicitly, by using - (void)openWithBehavior:(FBSessionLoginBehavior)behavior completionHandler:(FBSessionStateHandler)handler; which, I think, is not your case.
2) If there is no Facebook app installed on the device, FB SDK falls back to using WebView login window.
3) Probably, this is your case. If you are requesting publish permissions on the first attempt to open FB session, FB SDK will also fall back to old login flow envolving WebView. In the new login flow, FB session is supposed to be open with read permissions first (in that case, FB will use fast app switching or native iOS FB login):
+ (BOOL)openActiveSessionWithReadPermissions:(NSArray*)readPermissions allowLoginUI:(BOOL)allowLoginUI completionHandler:(FBSessionStateHandler)handler;
Then, you should ask additional publish permissions from the user:
- (void)requestNewPublishPermissions:(NSArray*)writePermissions defaultAudience:(FBSessionDefaultAudience)defaultAudience completionHandler:(FBSessionRequestPermissionResultHandler)handler;
That way, user will not need to log in (if he is logged in FB app already), but there will be inconvenience of double switching from your app to FB (though it works rather fast lately).
I was looking for a cleaner way to get publish permissions with FB Single Sign On on the first call, but unfortunately didn't find anything working yet.
Every time i want to login through the Facebook idk, safari will be opened and tells me that my app is allready authorized. But i dont want to show this screen everytime a user logs in with Facebook. I followed the instructions over here to implement facebook login functionality. If the auth button is clicked i simple call the openSessionWithAllowLoginMethod which then handles the rest for me. But i dont how to apply the functionality, that it wont show the authorized screen everytime, to this code ? I would really appreciate some tips or hints.
Fill out every field related to your app in the Native iOS App section of the Basic Settings in the App Dashboard. If these fields are not configured, we can't drive traffic to your app or the iOS App Store. In addition, we use the iOS Bundle ID to streamline authentication for users who already authenticated your app. Pro-tip 3: Complete all iOS App Settings
If you have both Facebook iPhone app and Facebook messenger app installed in your iPhone, I noticed that, as long as you are logged in in the Facebook app, Facebook messenger app knows who you are immediately!
How did facebook do that?
How do two applications talk to each other?
I am interested to know this because I want to know if it is possible for two applications to share some common data (e.g. products database) so that those data only has to be updated in one app.
A suite of iOS applications can use Keychain Access sharing to share credential information. You cannot, however, share a database on the device. You would need to either create one monolithic app, or store the shared data off-device.
I'm gonna take a guess but I think they storage your UDID in their DBs with the current logged user
Basically this is done using Single Sign-On (SSO) feature of the Facebook iOS SDK. According to the facebook developer documentation, https://developers.facebook.com/docs/mobile/ios/build/#implementsso,
it states that if the user already has the Facebook app of version greater than 3.2.3 installed and that the iOS device of the user supports multitasking, then basically the app (the facebook messenger in this case) can ask for the current logged in user information from the main Facebook program.
"One of the most compelling features of the iOS SDK is Single-Sign-On (SSO). SSO lets users sign into your app using their Facebook identity. If they are already signed into the Facebook iOS app on their device they do not have to even type a username and password. Further, because they are signing to your app with their Facebook identity, you can get permission from the user to access to their profile information and social graph"
"If the app is running in a version of iOS that supports multitasking, and if the device has the Facebook app of version 3.2.3 or greater installed, the SDK attempts to open the authorization dialog within the Facebook app. After the user grants or declines the authorization, the Facebook app redirects back to the calling app, passing the authorization token, expiration, and any other parameters the Facebook OAuth server may return."