1

我正在做一个 facebookapp 的演示,它只想从应用程序中获取一个 acces_token。该应用程序完全是客户端,我没有服务器端的可能性。此时我正确加载了 javascript sdk 并使用以下参数初始化了 facebook:

FB.init(
    {
        appId: 'XXXX',   //XXXX is my AppID
        // channelUrl: http://bla,
        status: true,
        cookie: true,
        xfbml: true,
        oauth: true
    });

我的问题是功能:

 FB.getLoginStatus(function (response) 
    {
        alert('Check login: ' + response);
        console.log("3");
        if (response.status === 'connected') 
        {
            // the user is logged in and has authenticated 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;
            console.log("Access Token: " + accessToken);
        } 
        else if (response.status === 'not_authorized') 
        {
            // the user is logged in to Facebook, 
            // but has not authenticated your app
        } 
        else 
        {
            // the user isn't logged in to Facebook.
        }

    });

没有任何反应。

有谁知道为什么??

4

0 回答 0