Facebook Logout on Chrome Extension

你说的曾经没有我的故事 提交于 2019-12-22 12:10:19

问题


I have a chrome extension that uses the facebook Graph API

Because its a Chrome extension I was using the Native App flow to login. I used content-scripts to grab the token out of the redirect URL.

However, I'm unable to find a way to logout of facebook. I tried the logout method posted here: Facebook Oauth Logout , but it doesn't seem to work ( I used my App Id as the API key and the "code" parameter returned by the redirect as the session key )

Does anyone know of a way to do this?


回答1:


So, after tracing the SDK logout procedure I found it just deletes the users Cookies for Facebook. Specifically this chunk of code will log the user out in a chrome extension (requires cookie permission):

var facebookDomain = "http://www.facebook.com";
chrome.cookies.remove ( {"url": facebookDomain, "name": "act" } );
chrome.cookies.remove ( {"url": facebookDomain, "name": "c_user" } );
chrome.cookies.remove ( {"url": facebookDomain, "name": "checkpoint" } );
chrome.cookies.remove ( {"url": facebookDomain, "name": "lu" } );
chrome.cookies.remove ( {"url": facebookDomain, "name": "s" } );
chrome.cookies.remove ( {"url": facebookDomain, "name": "sct" } );
chrome.cookies.remove ( {"url": facebookDomain, "name": "xs" } );


来源:https://stackoverflow.com/questions/7949610/facebook-logout-on-chrome-extension

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!