Facebook connect silent logout along with my logout url? - facebook

I have created a facebook connect login script in addition to the custom login script my site uses, which records FB user id and stores in my DB. It uses facebbok.php scripts provided by facebook and JS based popup login dialog (oauth).
I just authenticate user from FB account and do my own cookie based login on the basis of matched fb user id.
Now the problem is I can get logout url from php using getLogoutUrl() but how to logout silently without changing url in address bar using my logout.php? I tried destroySession() but it didnt logout fb user.
If user dont logout using getLogoutUrl() then next time when some other loggedin FB user tries to use fbconnect login the FB dialog box gives error "An error occurred. Please try later". Then I have go back to IE and logout that FB user from there and it works.

You can't "silently" logout a user using Facebook API. What you can do is test if the user is logged using getLoginStatus

Related

Facebook Session Not Setting

I have used Facebook Connect to Login in my site and Currently I m not logged in and my Facebook account is logged in another tab so when I goes to our site I dont get the Facebook Session i.e. when I print $facebook->getUser() I got 0.
SO can anyone please help me put what I can do for it.
I always get the active access token error
When you have not logged in your application the application will return 0 with
$facebook->getUser()
this is because user has not logged in the application, to get the user you have to either redirect user to login URL or ask user to login by clicking on url provided by:-
$facebook->getLoginUrl()

Facebook Page update through external page

I'm new to Facebook App development and I got this Problem:
I've created a Facebook Page (so I'm the administrator). Now I would like to have an external Webpage with a simple textarea and a "send" button. So everybody who has the link to this page could update this Facebook Page even without a Facebook account. This status update should be send by my page administrator account.
I thought I could write an app and authorize this app to publish_streams on the page and after the authorization I could switch $fbuser = $facebook->getUser(); to $fbuser = IDOFMYACCOUNT.
So the fbuser would be always my account wich is allowed to post to the Page.
If I try to use this application with an other browser (wich isn't logged in to my fb account) I get this error: (#200) The user hasn't authorized the application to perform this action
So this is the way I thought I could solve my problem.
Do you guys have an idea how I (and other people who don't have a FB account or don't wan't to login or I don't want to add them to Facebook Page administrator) could update the Facebook Status of a Page from an external website?
You will need your token "baked in" to your code and some sort of admin back end to update the access token before it expires.
Also you need manage_pages permission and the token of the page if you want to post as the page.
This can be accessed from /me/accounts

Facebook Enhanced Auth Dialog not Appearing when User is Not Logged In

If a user follows a link to my Facebook application (apps.facebook.com/instantinternetstar) and they are not currently logged into Facebook they are allowed to enter the Application instead of being prompted to 1st log into Facebook and 2nd grant permissions via Auth Dialog.
If a User is logged into Facebook, the new Enhanced Auth Dialog works perfectly and always.
Is there a variable I have missed?
Your settings may be fine. What you can do on the default page of http://instantinternetstar.com is to query the http post parameter called signed_request, decode it and it will tell you if the user is authenticated or not. Then you can display something to them so they know what you're about, before they take their time to login to Facebook, then accept your app.

Force logout facebook oauth

I'm using https://graph.facebook.com/oauth/authorize?client_id and when the user logs in and accepts the app it goes on to the next page and then finally logs him out using his access token.
My problem is when the user signs in and denies the app. How do you log him out if the access token was never returned?
I've tried the javascript but no luck with that.
Thanks.
You can't force user to logout when they didn't allow you to do so.
Facebook will redirect any user denying the app back to your login url with an error specified:
If the user presses Don't Allow, your app is not authorized. The OAuth
Dialog will redirect (via HTTP 302) the user's browser to the URL you
passed in the redirect_uri parameter with the following error
information:
http://YOUR_URL?error_reason=user_denied&
error=access_denied&error_description=The+user+denied+your+request.
http://developers.facebook.com/docs/authentication

Facebook logout problem

I am using Facebook Login button in my website.
Visitors can log in via facebook successfully.
FB login is working integrated with my own membership.
I mean I keep logs of FB logins.
The problem is here;
User may log out from my site by clicking Logout button (my own logout button)
When they press the logout button, i redirect them to logout.php and run the following JS;
"FB.logout()"
The JS code causes that user logout from their facebook account not my site.
If they login facebook on an another tab, and refresh my page they will log in again.
How can i end a session that user open via Facebook on my site?
You also have to clear facebook sessions from your machine with below code:
using Facebook;
Thread.Sleep(1000); // delay is required to get it work
Facebook.Session.ConnectSession cn = new Facebook.Session.ConnectSession(ConfigurationManager.AppSettings["APIKey"].ToString(), ConfigurationManager.AppSettings["Secret"].ToString());
cn.Logout();