Facebook API's fb:registration returning “Invalid 'client_id'” when not connected to Facebook

∥☆過路亽.° 提交于 2019-11-29 14:27:40

You might have to configure your application to let users other than the developers to access the app. I had a hard time finding it, but if I remember well, it was a matter of sandboxing the app or not.

I ran into the same problem, except I had the sandbox disabled already. I had included the script tag as

<script src="http://connect.facebook.net/en_US/all.js#appId={YOUR_APP_ID}&xfbml=1"></script>

<fb:registration 
  fields="name,birthday,gender,location,email" 
  redirect-uri="https://developers.facebook.com/tools/echo/"
  width="530">
</fb:registration>

as it was on the registration example page, however, the JavaScript SDK page had

<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
  FB.init({
    appId  : 'YOUR APP ID',
    status : true, // check login status
    cookie : true, // enable cookies to allow the server to access the session
    xfbml  : true  // parse XFBML
  });
</script>

Removing the #appId={YOUR_APP_ID}&xfbml=1 from the external script tag did the trick.

If you registered your application with Facebook they will give you an appID which you will need to use instead of the '123456789' AppID in the code above.

Just guessing here - because I had a similar but non-identical problem:

If you use the Facebook XFBML code on http://developers.facebook.com/docs/plugins/registration/ and replace the word {YOUR_APP_ID} by {1234123434534} (or whatever), it fails because it isn't expecting the curly brackets. (Different from various other areas that use JSON and are expecting them).

I don't know if this is what you've done wrong, but it's an easy mistake to make, as I just discovered.

Ayush Pant

For testing set your YOUR_APP_ID to 113869198637480

In my case, I was displaying the fb registration link without logging in the user first. After scratching my head for a long time, I asked the user to log in through facebook before presenting the registration form. The error was gone much to my delight.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!