I'm writing a hybrid app with Ionic and the workflow I imagine for a perfect facebook integration would be the following:
Scenario of a user logged in facebook with a native app:
Open my app
Touch login with facebook
Be prompted for facebook permissions and approve
Be directed to the desired screen of my hybrid app
Scenario of a user logged in facebook with his mobile browser:
Open my app
Touch login with facebook
Be prompted for facebook permissions and approve
Be directed to the desired screen of my hybrid app
Scenario of a user not logged in facebook (both in the native app and mobile browser):
Open my app
Touch login with facebook
Be prompted for facebook credentials
Be prompted for facebook permissions and approve
Be directed to the desired screen of my hybrid app
Is it possible to achieve as the mechanisms used to save session of a native app and a web app (facebook website) are way different?
How can I know if the native app is installed and once I know how can I use its session to prompt the user for permissions (as the android native apps do)?
Thanks in advance
Related
Problem:
1. My client has a simple website. They use login/register with Facebook.
The Register/Login is not smooth on iphones. The user is being redirected to www.facebook.com on Safari.
Most people are not logged into FB in Safari.
But most people have FB App installed and are logged in.
How do i redirect the auth/permissions to the Facebook App, and avoid having the user to log into Facebook on the browser.
Thanks
Gooch
It is not possible to use the "Single Sign On" feature in the browser afaik. I´m afraid you will have to let users login again.
How can I develop a kiosk mode app which will be used for many different facebook users. Each one could have logout by my app and not by the official facebook app cause they will not have access to the official facebook app.
In response, a facebook employ told me this: https://developers.facebook.com/bugs/696057353756212
any suggestion is welcome.
Basically, if you're building a kiosk app, you don't want to use SSO, since you cannot control who's logged into the Facebook app.
If you're using the LoginButton, it's as easy as doing something like:
loginButton.setLoginBehavior(SessionLoginBehavior.SUPPRESS_SSO);
And when your app exits, just do a closeAndClearTokenInformation() as you've already alluded to.
What SUPPRESS_SSO does is it will only bring up a web dialog for users to log in, and will bypass the Facebook app altogether.
I want perform a login using Facebook credential. This is possible using Facebook SDK with this step:
Create a Facebook App on facebook.developer.com
Import Facebook SDK in Xcode
Use Facebook SDK to perform login (this action open Facebook application on iPhone, and after it re-opens my application)
I would avoid open Facebook app and perform login inside my app, like Pinterest.
Using SocialFramework is it possible ?
Thanks
Yes, it is possible. The latest Facebook SDK logs in using the FB account defined in system settings if available and falls back to Facebook app and/or website if not.
In my app users can login by using facebook. I also have Facebook official app in my mobile phone and it is logged in. When I try to login from my app it asks for email and password. Is it possible to auto login if facebook app already logged in? How can I do that? because I know almost all apps use this feature
Have you considered Facebook SDK for iOS? Here is the link: https://developers.facebook.com/ios/
When a user clicks on the login with Facebook button on our website, we call:
https://www.facebook.com/dialog/oauth?client_id=xxxxxxx&
redirect_uri=http://xxxxx.com/Account/FBLogin&scope=email,publish_stream
Inside of our FBLogin (string code) method we do two things. First we call:
"https://graph.facebook.com/oauth/access_token?client_id=xxxxxxxxx&
redirect_uri=http://xxxxxx.com/Account/FBLogin&client_secret=xxxxxxxxxxxxx&code=" + code;
Then, if the FaceBook login was successful, we login the user into our site.
What is the equivalent of this workflow in iOS? We basically want to authenticate the user on our servers as part of the Facebook authentication. So when the Facebook authentication returns successfully, our user is also logged into our system.
Many thanks!
If you're using the Facebook iOS SDK, the SSO (single sign on) workflow is more like the Javascript SDK's workflow because the user is presented with what's similar to the JS SDK's popup: either in the form of a UIWebView, Safari Browser, or Facebook app (depending on the user's setup).
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 type a username and password.
Furthermore, you can get permission from users to access their
Facebook profile information and social graph.
SSO primarily works by redirecting users to the Facebook app on their
devices. Since users are already logged into Facebook, they will not
need to enter their username and password to identify themselves. They
will see the Auth Dialog with the permissions that your app has asked
for, and will be redirected to your mobile app with the appropriate
access_token.
Developers should be aware that Facebook SSO will behave slightly
differently depending on what is installed on a user's device. This is
what happens in certain iOS configurations:
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 Auth Dialog within the
Facebook app. After the user grants or declines, the Facebook app
redirects back to the calling app, passing the access token,
expiration, and any other parameters the Facebook OAuth server may
return.
If the app is running in a version of iOS that supports multitasking,
but the device doesn't have the Facebook app of version 3.2.3 or
greater installed, the SDK will open the Auth Dialog in the Safari
mobile browser. After the user grants or revokes the authorization,
Safari redirects back to the calling app. Similar to the Facebook app
based authorization, this allows multiple apps to share the same
Facebook user access_token through the Safari cookie.
If the app is running in a version of iOS that does not support
multitasking, the SDK uses the old mechanism of popping up an inline
UIWebView, prompting the user to log in to Facebook and grant access.
The FBSessionDelegate is a callback interface that your app should
implement: The delegate methods will be invoked when the app
successful logs in or logs out. Read the iOS SDK documentation for
more details on this delegate.
... when the user finishes either signing in or not signing in and returns to your app from the "popup", your app has to decide what to do based on whether or not the user logged in/authorized the app (and a valid access token received).
Please read this for more info:
https://developers.facebook.com/docs/mobile/ios/build/#implementsso