【问题标题】:Facebook Canvas application using Javascript SDK使用 Javascript SDK 的 Facebook Canvas 应用程序
【发布时间】:2011-10-01 02:57:15
【问题描述】:

希望有人可以帮助我。我有一个 facebook 画布应用程序。我正在使用此代码进行身份验证

window.fbAsyncInit = function() {
    FB.init({ appId: '123842974364777',
        status: true,
        cookie: true,
        xfbml: true,
        oauth: true});

        this.vars = {
            access_token: '',
            album_id: '',
            items: '',
            user_id: '',
            photo_path: '',
            errorHandler: 'There was a problem posting your picture!<br> Please contact <a href="mailto:support@eshots.com">support@eshots.com</a>',
            counter: 1
        }

    authenticate();

    function authenticate() {

        FB.getLoginStatus(function(response) {
            if(response.authResponse) {
                // logged and known to app
                // store access token
                vars.access_token = response.authResponse.accessToken;
                sendUserInformation();
            } else {
                // not logged in or unknow to app
                // prompt user to authorize app
                FB.login(function(response) {
                    if(response.authResponse) {
                        // store access token
                        vars.access_token = response.authResponse.accessToken
                        sendUserInformation();
                    }
                }, {scope: 'email,read_stream,user_birthday,user_photos,publish_stream'});          
            }
        });
    } 

};
(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);
}());

我的问题是,运行此代码不会在 facebook iframe 中显示我的页面。它只是停留在网络域上。我需要的是让这个页面显示在 facebook iframe 中。

我必须添加什么才能做到这一点?

感谢任何帮助!

【问题讨论】:

    标签: javascript facebook sdk oauth


    【解决方案1】:

    您是否已在开发者应用中设置您的画布 url/安全 url 以指向您的画布代码?

    这应该基本上指向您的域,例如http://mydomain.com/mycanvasfolder,其中画布文件夹将包含您要显示的索引页面。

    您应该能够在没有任何其他配置或 FB 内容的情况下看到基本页面。

    【讨论】:

    • 嗨达斯汀!是的,一切就绪!
    • 如果您直接访问为 facebook 设置配置的链接,您会收到回复吗?您使用的代码应通过 iframe 或直接通过您的网站访问。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多