Can Facebook's "Single Sign On" be achieved within a mobile web app? - facebook

It's my first posting on here (although I've been using this site for reference for quite some time).
I've been trying for several days now to find or dream up a way to use Facebook's "Single Sign On" from within a mobile web app (not a native iOS or Android app) to automatically sign a user into a web app if they are already logged into Facebook from the native Facebook app on their mobile device for example.
My limited knowledge is telling me that it can't be done since the mobile browser and the 'system' (iOS for example) are too separated (I can't, I don't think, have my mobile web app use or access the native Facebook app on a mobile device in any way).
I have found and read the iOS, Android AND Mobile documentation provided by Facebook (https://developers.facebook.com/docs/guides/mobile/) which all seems to make enough sense, but after days of trawling through everything else I could find on the subject there doesn't seem to be a way to use, for example, the Facebook app on an iPhone or Android device to automatically log a user in to my web app if he/she is already logged into Facebook.
I've read lots about doing this from within 3rd party native apps and also other people trying to achieve a similar thing from within Desktop apps but I'm trying and hoping to be able to achieve this from a web app running within a mobile web browser.
I'd be very grateful for any help, opinions or pointers in the right direction since I think this would be an excellent step forward in UI for mobile web apps to have (not just the native apps).
Many thanks in advance...

Probably a bit late to the party but in case anyone else is wondering yes it's possible with Cordova/Phonegap and the Facebook Connect Plugin: https://github.com/davejohnson/phonegap-plugin-facebook-connect/
Using the FB.getLoginStatus() method at startup allows to check if the user is already signed in with the native Facebook App and retrieve its profile. More details in the examples provided in the repo.

I have not yet implemented it myself, but seems possible according to:
http://developers.facebook.com/docs/mobile/web/build/#login

Related

Determining kind of facebook app

https://apps.facebook.com/horoscopes/?fb_source=search
Can anyone tell me what kind of facebook app it is? canvas or something else?
I would want to create an app in php but have no clue where to start from. Can i create a test app and start the process? please help.
I have tried creating an app but that needs to be approved before even starting the development and showing us as a page on facebook app
Any app with an address of apps.facebook.com/* is the Canvas link to the App, which means this app has a canvas page at the minimum. It may also have a website and mobile app associated with it, but that's harder to determine.
You should so some research before trying to create an app. You do not need to get any sort of approval to develop an application, even if you use excessive permissions. However, you will need to get your app approved for any extra permissions prior to launching to end-users.
You should visit the Facebook Developer website and pick a SDK you're comfortable with. I would recommend using the JavaScript one to get started, but the choice is yours. Then you should follow the starter guide to creating your first app. Everything you need to create an app is discoverable through Google, and I have a few handy tutorials on my site for using the PHP and JavaScript SDKs.

Facebook App Center on Desktop Game

I've been developing a desktop PC game in Unity which connects to Facebook in order to post messages about the player's progress (high score etc). The chosen method of how the app integrates with Facebook is currently set to "Website with Facebook Login". Everything is already set up and working (Open Graph stories, action and types) but after trying to submit the app for review, it appears desktop apps are not allowed to be configured this way.
The question I am asking is, if desktop apps are not allowed to use App Center, what are the preferred methods of posting messages to a users wall? There is the option of using normal feed posting but it is my understanding that this approach does not allow custom stories and will only display a generic message.
Does anyone have experience with the matter or perhaps has integrated it in their own game / app in the past?
Just to clear up a misconception in the question, an app can appear in Facebook's App Center even if it doesn't publish anything to Facebook - it must be on a supported platform (iOS, Android, or Facebook Canvas), though. And an app that doesn't appear in App Center can still publish to the site, too. The two are not connected.
That said: The feed dialog is actually highly customizable, and relatively easy to integrate into any game that can invoke a Web browser. Check out its documentation for details.
Additionally, you can create highly structured messages using the Open Graph. Doing this requires you to get the user's authorization, probably using a Web dialog. You need to request the publish_actions permission to do so; a few games (case study here, e.g.) have had remarkable success building out appealing OG implementations.
None of this is really specific to the Unity SDK at this point, I'm afraid, as it doesn't currently have native desktop support (just iOS, Android, and web player). But I hope it's helpful.

Facebook native mobile application and mobile browser sharing session

I have a website which allows login via facebook functionality and displays photos from facebook.
While accessing from a mobile browser I would like the website to automatically login(when the click on FB login button, without entering username and password) if the user is already logged in via the native FB application (iOS or andriod). It seems to be that I can do that by building a native iOS or android application and use facebook single sign on feature. Is it possible to do that without having the user install anything on their mobile device?
That is not possible.
Auto-Login relies on auth tokens that will be granted to a website or mobile app after a user approves an app. For security reasons, those tokens are tight to the cause they were issued for. Particularly, web tokens and mobile tokens are not interchangeable.
So you could build a native mobile app to get a "native token", but even if you would manage to (cookie-)inject it into a browser view, your website's backend couldn't use it.
More generally, you're raising an issue even facebook can't solve: Say you are using a facebook mobile app and logged in there. If you open facebook's web version on that very same phone, you'll have to log in there again. The root cause is the same as with above. Specifically, any native app is uncapable of setting arbitrary auth cookies into the OS browser. I personally believe this restriction will not fall, because it would have a large security impact - just imagine how any app could set (and possibly get) cookies for any website.
If they've never logged in facebook from their Mobile, how will your website ever know them ?
Is it possible to do that without having the user install anything on their mobile device?
Like PC's, users in a mobile device need to login in their phone in facebook's website before being eligible to login "automatically" to your website. When I say automatically, I mean they still have to go with the first time process of "Do you authorize this app/website to do X things on your account". That message is inevitable when using facebook's api on the web.
Hope this answers your question.
Is it possible to do that without having the user install anything on
their mobile device?
No this would not be possible. You need to have a native or hybrid app (phonegapped etc) to make it work. Mobile web apps run in a browser sandbox and without native code interface - you cannot get to the native SSO of FB on your mobile device
Did you have a look at this facebook page ? I'm not sure what you ask is possible, as basav said, but maybe you'll have some clues there.

Detecting installed apps on iPhone with javascript or url

I am building a HTML5 based mobile web app for iPhone. I need to check whether user has specific application that I suggest. I heard that each iPhone application has unique URL scheme to detect their app indentity.
Therefore, I've read this article to get an idea.
Is it possible to register a http+domain-based URL Scheme for iPhone apps, like YouTube and Maps?
However, this is not perfect answer to make what I am trying to make.
here is what might happen
User clicks a recommendation app on mobile web browser.
Check with application iTunes URL and URL scheme.
If the user has the installed application, it returns 'installed'
==> In this case, the screen returns back to mobile browser.
If the user does not have the installed application, it returns 'uninstalled'
==> In this case, the screen moves to App Store.
I am running mobile web app with PHP language.
Thank you.
this is not possible I'm afraid. To be honest I'm glad, as there are real privacy concerns if any old web page can detect which apps I have installed.
That's definitely not a good thing!
UPDATE: If you're happy to go native, this library will do what you want.. http://www.cocoacontrols.com/platforms/ios/controls/ihasapp
If you know that a url scheme for the app exists then you can open it via a web link like this, "myapp://". With this there are some round about ways you can effectively check if a certain app exists.
See this related stackoverflow post

Facebook authentication with new 'Facebook SDK for iOS' vs. old 'Facebook iPhone SDK'

I'm working on integrating Facebook with my iPhone/iOS application and I want to know if I'm understanding the nature of the login procedure correctly.
With the old Facebook SDK ('Facebook iPhone SDK'), when we needed to request authentication permission from a user a UIWebView would be displayed with a login prompt. With the new SDK ('Facebook SDK for iOS'), the SDK uses Apple's fast-app-switching feature to temporarily place the app in background mode and then load the iOS Facebook app or Safari to authenticate. Is this basically the gist of it?
I've experimented with authenticating my app via the new SDK's technique and due to the nature of my app, it just can't support backgrounding. Does this mean I have to use the old SDK to launch a UIWebView-based authentication? I think this implementation is a lot cleaner anyway. Will I run into any major disadvantages from doing this?
Check out this question and my answer: Iphone facebook connect example calls safari. I don't want to use safari
You can make it use the UIWebView always. Facebook is trying to make it so the user only has to log in once per device (through either the Facebook app or in Safari) but I didn't like this flow (especially on the iPad). Though I'd rather not muck around with the Facebook code, I did find commenting out a few lines to be a quick way of getting the old behavior back.
I don't believe this is the case.
The Facebook SDK that I'm aware of, available at https://github.com/facebook/facebook-ios-sdk doesn't do anything like you describe. Is this the SDK you're using? I believe the last major update to this SDK from the "old" facebook SDK was to add support for OAuth-style authentication. With this change they broke code compatibility so apps were forced to make changes to incorporate the latest SDK.
When you call 'authorize' in this SDK you pass the app id, the desired permissions, and a callback delegate for notifications of errors or success (did login, did not login, did logout). You can also set any access token that you might have persisted from a previous session. Facebook validates this access token, and if it doesn't exist or is invalid it presents a modal login dialog. I believe the content of this dialog is a web page. The SDK authenticates the user using OAuth and makes the auth-token available for persisting between sessions.
At no time is the app exited to run the Facebook app or Safari. I'm curious - what led you to believe this was the case? (Or, perhaps there is some other SDK out there I'm unaware of?)
Take a look on this page: https://github.com/facebook/facebook-ios-sdk
And look at Single Sign-On. That describes the above scenario with fast switching.