我正在爲我們的網站上的臉書連接創建登錄代碼, 但是我無法找到如何檢查用戶是否具有所需的權限。臉書連接:檢查用戶是否具有javascript的權限
與舊的JavaScript,一個對話框將打開每個權限和返回代碼會說,如果權限被接受或不,它是如何工作的JavaScript代碼?
這裏是我走到這一步的代碼,與TODO這裏我要檢查用戶是否得到了許可
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({appId: 'MY API KEY', status: true, cookie: true,xfbml: true});
FB.Event.subscribe('auth.login', function(response) {
alert("logged in");
//TODO: check if all perms has been accepted!!!!
//if they have NOT been accepted, I want to logout the user
});
FB.getLoginStatus(function(response) {
if (response.session) {
// logged in and connected user, again, check if all perms has been accepted
alert("already logged in");
}
});
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol +
'//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script>
<fb:login-button perms="email,user_birthday,status_update,publish_stream" >Login with Facebook</fb:login-button>
順便說一句,在文檔中,他們有這樣的例子 http://developers.facebook.com/docs/reference/javascript/FB.login
哪裏他們使用自定義按鈕,這就是爲什麼我懷疑會有類似的fb:登錄按鈕
只是問:http://stackoverflow.com/questions/3388367/check-for-extended-permissions-with-new-facebook-javascript-sdk/3388721#3388721 – serg 2010-08-02 17:38:11
肯定肯定有沒有fql的方式呢? 謝謝,如果沒有別的東西出現,可能會使用fql解決方案 – JohnSmith 2010-08-02 17:57:05