Facebook注册页面 - 当没有登录到Facebook时,'client_id'无效 [英] Facebook registration page - Invalid 'client_id' when not logged into Facebook

查看:465
本文介绍了Facebook注册页面 - 当没有登录到Facebook时,'client_id'无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经按照我的预期,制作了一个适用于自定义字段和功能的Facebook注册表单,当用户第一次访问表单时,用户未记录到Facebook中,则不需要。

I have made a Facebook registration form that works with custom fields and functions as I expect, EXCEPT when the user is not logged into facebook when they first visit the form.

在这种情况下,表单不会在屏幕上显示,并出现以下错误:

In this situation the form does not render on screen and the following error appears:


无法加载此ID的注册表单。你可能有
以前在Facebook上封锁了这个应用程序。转到您的Facebook隐私权
设置来取消阻止这个应用程序。 (错误:'client_id'无效。)

Unable to load the registration form for this ID. You may have previously blocked this app on Facebook. Go to your Facebook privacy settings to unblock this app. (Error: Invalid 'client_id'.)

现在我已经知道这已经在网站上讨论过,但是其他地方提供的解决方案对我而言,我真的希望这可以在Facebook支持的XFBML解决方案中工作(一个demo在这里 http://developers.facebook.com/docs/plugins/registration/

Now I know already that this has been discussed on the site but the solutions offered elsewhere don't work for me and I really want this to work based in the XFBML solution that facebook supports (a demo is here http://developers.facebook.com/docs/plugins/registration/)

如果您注销Facebook,您可以访问我的代码,直接从Facebook的例子,直接从这里修改: https://www.askanutritionist.com/fb .html

If you logout of facebook you can visit a test of my code, taken directly from the facebook example and hardly modified here: https://www.askanutritionist.com/fb.html

顺便说一句,沙盒在Facebook应用设置中被禁用,因为它是一个常见的解决方案有建议。

By the way, yes sandbox is disabled in the facebook app settings as thats a common fix others on S.O. have suggested.

感谢您的时间。
注意;我会用这个话题评论其他现有的问题,但是stackoverflow不会让我(还)。

Thanks for your time. Note; I would have commented on other existing questions with this topic but stackoverflow won't let me (yet).

推荐答案

只是为了确认;我从来没有真正解决这个问题。相反,我做了一个工作,并能够通过Facebook sdk做一个JavaScript检查,以查看用户是否已经登录,当他们第一次登录有facebook注册表单的页面。

Just to confirm; I never actually fixed this properly. Instead I made a work around and was able to do a javascript check via the facebook sdk to see if the user was logged in or not when they first hit the page that has the facebook registration form.

如果他们没有登录(或未被授权),并且如果他们在后面的页面中登录,我会调用来初始化脸书表单。

I do an http redirect if they aren't logged in (or aren't authorised) and if they are logged in later in the page I call to init the facebook form.

window.fbAsyncInit = function() {
FB.init({
    appId      : xxxx, // App ID
    channelUrl : 'http:///xxxxx/fbchannel.php', 
    status     : true, // check login status
    cookie     : true, // enable cookies to allow the server to access the session
    xfbml      : true  // parse XFBML
});

// Additional initialization code here
FB.getLoginStatus(function(response) {
    if (response.status === 'connected') {
        // all ok!
        //var uid = response.authResponse.userID;
        //var accessToken = response.authResponse.accessToken;
    } else if (response.status === 'not_authorized') {
        window.location.href="create_account_with_facebook?authorizefirst";
    } else {
        window.location.href="create_account_with_facebook?loginfirst";
    }
});
};
// Load the SDK Asynchronously
(function(d){
    var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
    if (d.getElementById(id)) {return;}
    js = d.createElement('script'); js.id = id; js.async = true;
    js.src = "//connect.facebook.net/en_US/all.js";
    ref.parentNode.insertBefore(js, ref);
 }(document));

这篇关于Facebook注册页面 - 当没有登录到Facebook时,'client_id'无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆