I can easily log in user to my site and get details of it on Facebook but I I'm not able to log out. On entering, I am landing members on the internal page for members. From there it presses logout from my web site. On pressing that it is sent back to the first page, which is definitely reloaded.
I think the user who logged in when he presses the logout button, he is sent to the front page. But the login event is automatically lit up and it is logged in again.
I am using the following code.
& lt; Script type = "text / javascript" & gt; $ (Function () (var button; if (document.cookie.indexOf ("fbsr_myappid") & gt; 0) {// I'm checking whether the cookie value is set, I create a status in FB.init () false Var fb_status = false;} other {var fb_status = true;} window.fbAsyncInit = function () {FB.init ({appId: 'myappid', position: fb_status, cookie: true, xfbml: true, oauth: True}); if (response. At response) {FBP ('/ m', function (info) ($ .post ("/ Web / register / faceBookRegistration", {data: info}) done (function Data) {if (dataof! = Undefined) {window.location = "/ web / login / loadFaceLogin"; // I have my login controller having loadFaceMember function To post an AJAX.}} Login (feedback, info);}) button. Click on = function () {// I think I should use filing elsewhere for FB.logout (function ( Response) {logout (response);});}} and click on button = function () {show loader (true); fb.login (function) {if (res Ponse.authResponse) {FB .api ('/ me', function (info) {login (feedback, info); }); } Other {showLoader (wrong); }}, {Scope: 'email, user_bridade, user_out_me'}); }}} FB.getLoginStatus (updateButton); FB.Event.subscribe ('auth.statusChange', updateButton); }; (Function () {var e = document.createElement ('script'); e.async = true; e.type = 'text / javascript'; e.src = document.location.protocol + '//connect.facebook. Net / en_US / all.js'; document.getElementById ('FB-root'). Appendbill (E);} ()); Function login (feedback, info) {if (response.authResponse) {var accessToken = response.authResponse.accessToken; ShowLoader (wrong); }} Function logout (feedback) {FB.logout (function (feedback) {console.log ("user is logged out now.");}); ShowLoader (wrong); } Function sholoder (status) {if (position) console.log ("yes sholoder."); Else console.log ("yes no showloader."); }}); On the server side, the following function is called logout controller when pressing the logout button.
function index () {$ isSessionExp = true; If ($ this-> Session-> User Data ('is_sess')) $ is session Ex = false; $ Login_session_id = $ this- & gt; Session-> User Data ('login_session_id'); $ This- & gt; Login_model- & gt; UpdateLogoutTime ($ login_session_id); $ This- & gt; Session-> Sess_destroy (); If ($ Session is the exp) redirect ($-> url. "/ Logout / session_start"); Other redirects ($ the-> url. / "Login"); } I think if I am able to link the above work in logout controller with the following lines of JavaScript code.
FB.logout (function) {logout (response)}} My work will be done.
Anyone Help will be highly appreciated.
"post-text" itemprop = "text"> Yes, what I had guessed was correct. There is a modified function here.
function logout {response.log ("from logout" + response); if (! Response.authResponse) {window .location = "/ web / login /"; return;} FB.logout (function Reaction) {FB.Auth.setAuthResponse (null, 'unknown'); logout ();}}}} Thanks to @GW for pointing me in the right direction. I hesitate to comment and improve it. I welcome that. My approach was based on this
No comments:
Post a Comment