Is it possible to log users out of my web app but keep them logged in with Facebook using Javascript sdk? - facebook

API page is here: https://developers.facebook.com/docs/javascript/reference/v2.6
As far as I know,
If users have already authorized a web app(a website), then invoking FB.login() and FB.logout() in the web app is essentially logging user in or out of Facebook and return the web app with some data(of course you need access token to do this). Assume you have two pages opened, one is your web app, the other is facebook.com. Both logged out initially. Now if you log in with your Facebook account in the web app page, and then if you refresh the other page, you will find that both are logged in. It's similar for the case of logging out.
Well, correct me if my understanding is wrong. I totally understand there are reasons for the logic.
Is there a way to log out users from by web app but keep them logged in with the Facebook and without revoking permission?
I've tried with Google+ OAuth. It seems that using Google+ API is able to log out users from the web app and keep them logged in with Google+.

Well it is how it should be. You want your app to be an interface for the "Facebook app" login, why is that? Consider the scenarios from the user's point of view-
User is logged-in and browsing facebook. He found the useful application of yours and login to your app(providing required permissions). Before leaving your app, he logouts from the app. He then gets back to the Facebook and continue browsing there. All good!
User in NOT logged-in to the facebook. He logs into your app, browse your app then logs out of it. Then, when he open the facebook.com why will he expect that he should be looged-in to facebook automatically? I think he wont think that and he'll login to facebook and continue.
The point is simple here-
if user logs into facebook, he'll be logged-in until and unless he logs out from facebook.
if user is not logged into facebook but logs into your app, he will be logged-in to the facebook until he logs out from your app.

Related

How to get to know from FB Login Web that a user has already logged in in native FB app and use it to login a user in web app?

I don’t know if there is a term for this issue already. So will try to explain it.
The question.
How to get to know from FB Login web that a user has already logged in in native FB app and use that auth session to login a user in web app? So that a user doesn’t need to see FB login dialog and provide their credentials again.
The problem.
There are users who never use FB in mobile browsers on smart phones. Only FB native app.
So when a user tries to login with FB in my web app, they are always asked to provide their credentials, email and password. And users complain that they are logged in already and don’t understand why they’re asked to login again. Many just do not remember their passwords.
So, does FB Login API foresee this use case, a combination of logins? Is it possible to implement it?
Similar question Facebook login to web via native FB app
UPD1:
Found this here.
However the question still remains: How to login in web app seamlessly without login dialog if logged in in FB native app?
Once someone has created an account on one platform, they can log into your app — often with a single click — on all your other platforms.

facebook php sdk logs out of website but does not logout of facebook

I have read many questions in a similar area to this and after reading about 20+ my problem is not discussed.
I have a web app using facebook login via the facebook SDK.
This is working fine on the website side of things.
However when using the getLogoutUrl( ) the users are not logged out of facebook.
I have done both destroying the facebook session (via the destroySession method) before and after (in the redirected page) accessing the getLogoutUrl link and I am still logged into facebook.
The user is not longer logged into my site but facebook remains unchanged.
I would expect that when a user accesses the link provided by getLogoutUrl that they would be logged out of facebook. However all that happens is the user is redirected back to the site and the user is still logged into facebook.
So my websites side of things works fine. But providing the facebook logout link implies that they are logged out of facebook and can walk away.
Where as in reality the users accounts is still logged in on facebook.
Why is this happening?
I cannot control facebook so I do not know what else I can do other than forwarding to the user to the logout link provided by getLogoutUrl.
I am using Facebook PHP SDK (v.3.2.2)

Facebook apps will be still be login while you are logged out from facebook, How?

I am working on the facebook apps, I got problem like when I logged out from facebook, my facebook apps will still be logged in. Can please any body help me on it.
This might be because your Facebook session for your app is not destroyed. The session for your application is maintained separate from the Facebook's session. You might also add the logout button on your app so you could explicitly logout.

Facebook PHP SDK getLogoutUrl

In the context of a facebook application what is the point in this? Since they cannot play your app till authorised and logged in. What purpose does logging them out of a facebook session and redirected to your app actually serve?
This method returns a URL that, when clicked by the user, will log them out of their Facebook session and then redirect them back to your application.
It is useful outside Facebook, in the context where the user authenticates via Facebook to log into your website.

Preventing facebook user to automatically login my site

well i have used the facebook api couple of times. But last day i just came across a site which was really new to me. Heres the scenario
If a user is logged in at facebook and comes to my site, he will
automatically be logged in without asking him and also if user logs
out of my site he gets logged out of facebook. But the site i saw
yesterday, they had handled it perfectly, user dose not logs in their
site automatically and even if user logs out from their site, he does
not gets logged out of facebook.
So any help? what is this technique called? or any relevant help?
Best Regards
most site handled the login/authenication by using the login status of the user at facebook ends.
to do what u wants, simply add an additional layer of authentication / login status checking at your own site.
The site level login status is to be retained only for the current session. In other words, once the user went away from the site, the site level login status is gone. With this, when the user returns, you know that he needs to login again.
when the user logged out from your site, you only log him out of your site and do nothing about facebook login
Using the Facebook SDK it will likely tell you the user is logged out when not logged into Facebook, which in theory is the correct behaviour of the whole system, as Facebook want user's to always be connected to Facebook, I quote facebook:
As long as the user is signed into Facebook, they are automatically signed into your site as well.
So if they aren't connected to Facebook, you aren't connected to other sites. In a way it's a deterrant and increases Facebooks market.
But anyhow, it's likely the site you are describing are implementing their own authentican system rather than using Facebook's own SDK, or if they are using the SDK they are using it in moderation and understand about cookies/the above.
The flow to allow the user to be logged into Facebook but out of your site is as so:
When a user logs out of their site, it will unset session data for the site's own application, and also unset Facebook cookies, etc. That way the user is still logged into Facebook but out of your site.
When they try to log in again, Facebook will detect no cookies are available and hence will re-authenticate and pass you onto the url as passed during the authentication process. Your site will then login the user to the site's own application, setting any session variables, etc.
you need to check how you are handling the FB logins and sessions at your end..
my guess is you check the is login at your site and there are some access_tokens which are as per your app id in the cookies of your browser which are helping you to log in ..
and when logging out from your site you are explicitly logging out the user from FB as well
( thats what you are describing atleast )
you seem to be explicitly calling logout or clearing the cookies for fb app id ..