"Invalid App Id" error on "Like" Facebook button

Asked

Viewed 846 times

-1

I’m doing a blog and I’m putting the button like. The code I’m using is:

This is at the top of the page:

<script>    
    (function (d, s, id) {
        var js, fjs = d.getElementsByTagName(s)[0];
        if (d.getElementById(id)) return;
        js = d.createElement(s); js.id = id;
        js.src = "//connect.facebook.net/pt_BR/all.js#xfbml=1";
        fjs.parentNode.insertBefore(js, fjs);
    } (document, 'script', 'facebook-jssdk'));
</script>

And to put the button I do so:

<div class="fb-like" data-href="@String.Format("{0}/{1}", "/Blog/Artigo", @item.ArtigoID)" data-layout="button_count" data-action="like" data-show-faces="true" data-share="true"></div>           

Looking at the Google Chrome console, I see 2 alerts, when I’m not logged in to Facebook that are:

Invalid App Id: Must be a number or numeric string representing the application id. all.js:53
FB.getLoginStatus() called before calling FB.init(). all.js:53

Why does this happen?
What I must be doing wrong?
Is there any way not to use Facebook’s JS and do something that opens a modal for the user to do the like? For to take the total of like has, but to give like I didn’t find.

1 answer

0

The App Id. Look at this line here:

js.src = "//connect.facebook.net/pt_BR/all.js#xfbml=1";

She has to be like this:

js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=SeuAppIdDe16Dígitos";
  • I looked for my app id is 15 positions. When I switched it got this error: Event.returnValue is deprecated. Please use the standard Event.preventDefault() Instead. The specified URL is not allowed by the application configuration.: One or more of the provided Urls are not allowed in the application settings. The URL must match the site URL or Canvas URL, or the domain must be a subdomain of one of the application domains. I used https://developers.facebook.com/apps/ to view the app id

  • I already went to https://developers.facebook.com/apps/168583496535883/settings/ and in App Domains I put the domain www.sesmt.org and nothing... I’m trying to find the solution...

Browser other questions tagged

You are not signed in. Login or sign up in order to post.