How to Create a Facebook Access Token

MashShare is working without an facebook access token well in most cases but if you are noticing that your share count stucks it's likely that your daily traffic has hitten the facebook rate limit or your website is running under a shared host and IP address which is already limited by facebook.

To prevent the rate limit you can use a personal facebook access token which is valid for 60 days. It allows your website to call the facebook API 200 times per hour.

To do so you need a facebook app first.
Read here first how to create a facebook app and its corresponding app id.

If you already did it you can continue here.

Login to facebook and go to  https://developers.facebook.com/tools/accesstoken/

Look for the app entries. If you have more than one facebook app, use the one you created for the website you are using MashShare on

You can already use the shown default User Access Token but this one is valid only for a short time.
So we want to extend that user token to a long lasting token which is valid for 60 days. 

To do so click first on  Debug and than on Extend Access Token.You will be prompted for your facebook password again and than you get a new long-lived access token with its expiration time

Copy this token and paste it into the Access Token input field under MashShare->settings->networks

You can verify if the access token is working by clicking on the button  Verify Access Token

If everything is working you get the message: Token valid. Facebook Share Count for  http://google.com: 398736734 
(The number will be different because it reflects the share count of the time point of this check)

If you get a message: Token invalid  use the following endpoint to test the token:
https://graph.facebook.com/v2.7/?id=https://www.mashshare.net/&access_token=youraccesstoken

It should be returning something like:

{
   "share": {
      "comment_count": 0,
      "share_count": 392
   },
   "og_object": {
      "id": "714206851986099",
      "description": "Grow your traffic\u00a0with this Supercharged Share Buttons for WordPress. Its adapted from the share buttons of the popular website mashable.com...and its free.  Do you want to attract an insane amount of traffic to your WordPress site",
      "title": "Grow your traffic with this Supercharged Social Media Share Buttons for WordPress",
      "type": "article",
      "updated_time": "2017-07-24T08:40:41+0000"
   },
   "id": "https://www.mashshare.net/"
}

If there is no share_count and you get an error, this means the access token is not eligible to request the facebook share count.
In that case, try to create a new access token or remove the access token from MashShare settings to be able to return any shares at all.

There are several reasons why your access token is not working. One of them could be that your website domain is blacklisted by facebook. Changing the domain name in the facebook app settings to another website domain could resolve this.

To be clear: If your access token is not working and you are not able to make it work, remove the access token at all. 
We - the MashShare Team - can not do anything to make your access token working!

Bear in mind that you need to recreate a new facebook access token after 2 month when the old one expires. MashShare will reminds you with an admin notice when it's time to renew.

Congratulations, you are done. Your website should be able to call the facebook API 200 times per hour now. 
That's enough for even huge sites with a lot of posts.

Still need help? Contact Us Contact Us