2012-01-07 99 views
0

我有一個運行在iframe中的facebook應用程序。當有新用戶進入時,它會要求獲得所需的權限,並讓用戶登錄以進一步使用該應用程序。如何爲iframe應用創建「歡迎頁面」?

現在我想把歡迎頁面放在用戶可以放入「邀請代碼」,如果用戶是新的,否則目前的流程要求許可將遵循。

所以我的問題是每次有用戶進來時我怎麼才能在他實際瀏覽權限對話框之前向他顯示一個頁面?

讓我知道,如果這個問題對你們其他人有意義,我會進一步解釋可能與步驟。

-deepak

回答

0

使用JavaScript SDK和調用FB.getLoginStatus(https://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus/)來確定用戶是否已經驗證過了到您的應用程序。

FB.getLoginStatus(function(response) { 
    if (response.status === 'connected') { 
    // the user is logged in and connected to your 
    // app, and response.authResponse supplies 
    // the user's ID, a valid access token, a signed 
    // request, and the time the access token 
    // and signed request each expire 
    var uid = response.authResponse.userID; 
    var accessToken = response.authResponse.accessToken; 
    } else if (response.status === 'not_authorized') { 
    // the user is logged in to Facebook, 
    //but not connected to the app 
    } else { 
    // the user isn't even logged in to Facebook. 
    } 
});