Unable to get access token from Facebook. Got an OAuthException says “Error validating verification code”

I recently dealt with exactly this problem: everything matched, but it failed with the OAuthException. The thing that made it work was to change the redirect uri (in both requests for the flow) from: http://foo.example.com to http://foo.example.com/ I.e., add the trailing slash. And then it worked. Stupid and silly, but there you go.

How do I customize Facebook’s sharer.php

What you are talking about is the preview image and text that Facebook extracts when you share a link. Facebook uses the Open Graph Protocol to get this data. Essentially, all you’ll have to do is place these og:meta tags on the URL that you want to share – <meta property=”og:title” content=”The Rock”/> <meta property=”og:type” … Read more

Facebook share link without JavaScript

You could use <a href=”https://www.facebook.com/sharer/sharer.php?u=#url” target=”_blank”> Share </a> Currently there is no sharing option without passing current url as a parameter. You can use an indirect way to achieve this. Create a server side page for example: “/sharer.aspx” Link this page whenever you want the share functionality. In the “sharer.aspx” get the refering url, and … Read more

How to get Likes Count when searching Facebook Graph API with search=xxx

Couldn’t find this in the documentation but multiple calls to the API are not necessary. You can use summary when querying a feed or multiple posts. Specify this in the fields parameter. https://graph.facebook.com/PAGE_ID/feed?fields=comments.limit(1).summary(true),likes.limit(1).summary(true) This will return a response like this. { “data”: [ { …. “summary”: { “total_count”: 56 } … }, { …. “summary”: … Read more

How to track content Statistics for Facebook Instant Articles with Google Analytics

According to their documentaion https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingCampaigns#generalCampaign It is possible to set the source, medium and title through the analytics script. the title it is needed to be set given that the page title for the IA on the FB app is null. PLEASE NOTICE THE CAPITAL LETTERS in the code are supposed to be updated with … Read more

Facebook access_token invalid?

When using your Facebook Application’s token If you’re using the me alias as in https://graph.facebook.com/me/ but your token is acquired for a Facebook Application, then “me” isn’t you anymore – it’s the app or maybe nothing. Anyway, that’s not your intention for the app to interact with itself. In this case you will want to … Read more

Check if user is logged in New Facebook API

Here is an example where fbLoginStatus() function will be automatically called when user logs in/logs out, so you can decide which div to display there. <body> <div id=”fb-root”></div> <script> function fbLoginStatus(response) { if( response.status === ‘connected’ ) { //user is logged in, display profile div } else { //user is not logged in, display guest … Read more