Facebook iOS SDK 'one-time' authorization - ios

I want to give users of my iPhone app the option to publish a story to their Facebook walls. Does this require that the user be presented with a sign on screen, and then a second screen authorizing the wall post or can these two screens be somehow combined into 1?

The sign on screen will let user key in his credentials and thus allowing your application to access the information. You might like to read Extended Permissions for Facebook API for iphone.
You will need to open a dialog box right after he logs in to allow your application to access.modify content on his profile (like publishing a story). I am afraid If these two screens can be combined into one.
You can also refer to http://www.capturetheconversation.com/technology/iphone-facebook-oauth-2-0-and-the-graph-api-a-tutorial-part-2

Related

OpenID-Connect, Google+ iOS SDK, no browser

It seems this used to be possible, but not anymore. Here's my dilemma: I'm creating an iPad educational software app, and I want to let students log in with their Google Apps for Education accounts using OpenID-Connect.
... I guess my first question is: is the current Google+ SDK the right way to perform login against GAFE? What about the forthcoming "Google Classroom"?
So say I do this - the student pushes the "login with google button", the sdk performs an app switch to safari and lets the user log in to their google account, push the permissioning buttons, and app-switches back to my app, and the user is now logged in. Fine. At the end of the class period, the user logs out of my app and hands in their device. The next period, though, another student logs in, and because the first user has forgotten to also log out of google in safari, the second user has access to their account.
... My second question is: is this a valid concern? Seems like this would be a pretty common usage pattern.
... Third question - can I get around this? Can I make Google+ sdk use an internal UIWebView, or no web stuff at all? This is what seems like used to be possible, but no longer...
EDIT: Spoke to google tech support for apps-for-enterprise (thx M!) and they say that there is no way to authenticate against google openid-connect without going through a browser. This is, I believe, a security problem - students being kids, they will forget to log out of the browser, and the next kids will get into mischief. Oh well.
The GPPSignin class describes itself as:
It provides single sign-on via the Google+ app (if installed), Chrome
for iOS (if installed), or Mobile Safari.
Internal web views are not mentioned. You may need to implement OAuth2.0 on your own to allow your internal UIWebView to manage authorization.
Google publishes an API which includes a method to signOut. You can use it at your app's discretion in addition to the SDK requirement that a user be able to sign out manually.
https://developers.google.com/+/mobile/ios/api/interface_g_p_p_sign_in

Does a user need to be logged in on Facebook to share an open-graph story through Facebook Messenger?

For a user to be able to message an open-graph story via the new Facebook Messenger functionality (messaging an open graph message), does the user need to be logged in to Facebook in my app?
I am talking about the new functionality presented by Facebook at their f8 conference (sending an open graph story to friends through Facebook Messenger).
I'm pretty sure I have everything set up correctly in my mobile app. But the problem is that the other testers (people registered as testers in my app on Facebook) are receiving the open graph story correctly, but when tapping on the open graph story, even though Facebook Messenger redirects to the right app (my app), the FBAppCall object doesn't contain any targetURL information, there is no &target_url=.... ...even though my open graph object has a proper URL set.
That is why I am thinking: Does the user need to also POST the open-graph the story somewhere (thus the user needs to be logged in with Facebook), in order for Facebook Messenger to be able to get the object's URL later?
It seems like this shouldn't be the case, as opening this new functionality of sharing through messenger should be just about getting rid that friction when sharing a story.
does the user need to be logged in to Facebook?
No, he doesn't.
does the user need to be logged in to Facebook in my app?
You must have a valid client token, which means your user must have authorized your app. Just once. Then he can log out from Facebook and/or your app, and you can keep the token on your database and make as many requests as you want, regardless of the user being logged in anywhere.
That means: After the user logs out from facebook, you still get to keep the client token for as long as you want (Well, they do expire: take a look at https://developers.facebook.com/docs/facebook-login/access-tokens/ for more info), and use it to make requests on behalf of the user as you please, using any of the permissions your app was granted by the user (read messages, send messages, post on my behalf, etc.).
In order to share an open graph story through facebook messenger, there must be a story to share published somewhere, of course.
Take on account privacy settings may prevent user/app A from seeing a user/app B story shared by someone else (user/app C) if user/app A didn't have permission to see the original post in the first place (happens when posting with 'only to friends' privacy setting, for example)
The best you can do: debug the responses your app is getting from Facebook. Every time something unusual occurs Facebook will notify you. Are you sure you are not getting any errors/warning messages?

How to avoid "App is allready authorized" with Facebook SDK 3.1

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

Can iOS Apps have Login Screen?

I need to add log in screen and registration forum to my application, such that the user register or log in to the application,
is it legal issue or my application will be rejected
You can have a log in screen. Many apps have them.
But Apple has been rejecting apps with a login registration screen, or even a registration web site URL within the app, depending on the exact conditions for that registration. You may have to get users to register for your app outside your app and/or before running your app. Make sure to preregister Apple with a demo account for use during app review.
It also helps greatly if your app has some general usefulness even without registering (e.g. banking apps may have a map to the nearest branch even for users who don't have customer account logins, or some public info about interest rates, etc.).
There are plenty of apps that also live on the web and so require some sort of login, e.g. Foursquare, Facebook
There are no issues at all with creating a login screen for your application. When you submit your app to the App Store, you will be asked to provide login credentials for the testing team to login and test your app. I wouldn't force them to go through the account creation process as it may delay your app getting approved.

iOS Facebook API - Post stories using custom/native UI

I'm starting development of a social app (oxymoron? :p) and wish to implement the Facebook api, however, I want to make use of native iPhone UI (i.e. text fields and buttons) to post stories.
I know it's against their policy to make custom login screens, and I won't do that. Just wish to make my own UI for posting stories and etc.
It kind of breaks my app idea if I can't do this, so really hoping there's a solution.
The dev pages on FB didn't prove much help.
Yes this can be done. Check the samples on the Facebook iOS SDK. You can prompt the user for the status to be sent, and then post this to /me/feed as per their API documentation. You will just need to have the user authenticate with your application first and prompt for publish_stream extended permission.

Resources