Facebook Logout causes logout from my application - javascript

I have created simple javascript widget where login happens using Facebook Single Sign On. It logins the person whenever he is logged in to facebook (after authorization for the first time). However, it also logs out the user when Facebook logout happens. I want the person to not get logged out when the person logs out of Facebook?
Suggest me what is the way around.

It is not possible to keep a facebook connection going once they are logged out. The way around would be to create your own user tracking.
Once a user is logged in through facebook - store their information in a session (cookie, table) and then rely only on that to check if this user is still logged in (you will need to implement your own logout too). This will work only if you use facebook as a login provider, if you need some interactions with facebook api that require login - they have to be logged in to facebook.

Related

Is it possible to know if my visitor is logged into facebook?

I want to know if a visitor to my website is logged into facebook or not?
And what information will I be able to fetch from the user's fb profile, so that to login user on my website if user had already synced his fb account?
You can only create an App and check if the User is authorized - without authorization, he is completely anonymous. What information you can fetch is explained in the API reference: https://developers.facebook.com/docs/graph-api
For example, you can check if the user is logged in with FB.getLoginStatus: https://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus
More information:
https://developers.facebook.com/docs/facebook-login/
http://www.devils-heaven.com/facebook-javascript-sdk-login/
Facebook's API has a function FB.getLoginStatus() that returns either a connected, not_authorized or unknown string depending on if the visitor has authorized your application, has logged in to facebook or neither.
If you want user data, like a picture or a name, you're gonna need to authenticate your application.

facebook js sdk. How do I login with facebook, without the user actually login into facebook?

I am new to stackoverflow, so I hope that I ask the question correctly.
For a website that I am working on, I have to implement login in using your facebook account. I have this working for the biggest part, since the user is able to login with using facebook and I'm able to retrieve the information I want.
But the problem is, whenever the user logs in with their facebook account, he automatically gets logged in into facebook itself. And whenever the user presses the log out button, facebook logs him out too. For the facebook login, I am using the javascript sdk from facebook.
This can be quit anoying for the user, since it must be possible for a random user to login my website using their facebook account, even when someone else is logged into facebook itself on the same computer.
So my question is: is it possible to login with facebook, without the user actually login into facebook, like just let facebook verify the account and send the requested information back? Using the facebook js sdk off course.
That is not possible. You cannot have 2 different Facebook sessions in one browser and you need to login to Facebook in order to login to your App.

How to logout user from the Facebook when he does not authorize the application

I have ASP.NET web application that
Runs on public computers
Allows users to register by using their Facebook accounts.
Must always logout a user from the Facebook after registration has been completed.
Registration process contains the following steps:
Registration page is shown with the Facebook icon.
When user clicks on the Facebook icon, he is redirected to the Facebook web site.
On the Facebook site user enters his email and password and clicks login.
On the Facebook site user clicks Allow to authorize my application.
User is redirected to my application.
The application registers used in the database.
The application calls FB.logout in order to logout from the Facebook. So when new user starts registration he cannot use account of previous user.
The application works perfect until user clicks Cancel at step 4.
When this happens, the browser is redirected to my application, the user remains signed into the Facebook but the application is not authorized by this user. This means that the application cannot logout this user from the Facebook by using the FB.logout method because the application does not have access token.
How to logout from the Facebook in this case?
Thank you.
How to logout from the Facebook in this case?
Not possible at all.
If logging a user out without a valid access token was possible, then every website I’m visiting could do that if they liked – I’m sure you can see how annoying that’d be to users, and that it’s therefor not possible.

Not completely logout using "www.gigya.com"

I am trying to integrate Gigya(www.gigya.com) javascript api for social network login . I am successfully login with facebook. Also when I click on logout button it seems that i get logout from facebook. But when I again click on facebook login button then it not asking for login id and password, directly get login from my account.
The code is use is as follows:
gigya.services.socialize.logout(conf, {});
I have searched on gigya's forum and i found that it only logout from gigya's platform but not from the facebook.
Can any one know, how to get out from this problem? Please help..
they have maintain their cookies and session that's why you can not logout from all for example stackoverflow if you used openId then you know that. when you login using openid for e.g. google account id then open gmail you directly view your inbox and if you logout from the gmail/stackoverflow then only one of them will logout because they have maintain individual cookies and session for login time they for openid they create cookies related to that service provider like google or anyelse
for this to happen we need to set the flag forceProvidersLogout to true in the params that we sent to gigya.
Refer to the api link # http://developers.gigya.com/020_Client_API/020_Methods/socialize.logout

How can I hook up facebook connect with our site's login?

I want to implement something similar to what Digg has done.
When the user logs in for the first time, I want it to force them to create an account on my site.
More importantly I want to know how to log a user into my site when they login with facebook connect. If they login with facebook connect, they still haven't provided me the password to their account on my site, so I can't use username/password to log them into my site. How do they do this on Digg or sites similar to this?
Facebook's process flow can definitely be a bit confusing. Take a step back from the details and the API, and look at the overall flow here:
Facebook Connect will tell you that a user is logged into Facebook, and give you their Facebook ID. You can validate that ID against Facebook using Facebook Connect to make sure it is properly logged in. Once this is done, you don't need a user name and password. As long as you trust that Facebook has authenticated the person properly, they are the only ones that can come to your site using that Facebook ID. That is enough information to start an authenticated session based around a local account that is associated with that ID.
The process you should follow is like this:
User logs in to your site with
Facebook Connect for the first time
You notice that you don't have a local account associated with that
Facebook ID, and prompt them to
enter local account information
You save that information along with their Facebook ID
The next time you see that Facebook ID (and validate that it is
logged into Facebook using the
Facebook API), you can start up a
local session using the associated
account.
Basically you end up with two separate methods of authentication: a Facebook Connect ID check, or the regular username/password login on your site. Either one should have the end result of starting a local authenticated session.
Hope that helps.

Categories

Resources