What is the “Unsupported get request.” error?

I’ve written about this error before on my other blog, but it should be here too.

This error is vague and annoying, but all it is telling you is you’re trying to access age restricted content and it requires authentication. For example if you try to access http://graph.facebook.com/budlight you’ll see this:

This error occurs because the page is marked as alcohol related and Facebook needs to see who the user trying to access the page is to verify their age.

Facebook Page Age Restriction

To get around this all you need to do is pass in your access token and you’ll then get the full page without the error. Ex: http://graph.facebook.com/budlight?access_token=abc123


How to use Facebook test accounts

Developing an app on Facebook can lead to a lot of test posts, likes, and what not. If you do all this testing on your main Facebook account, you may lose a few friends by the end of things so it’s generally not a great idea. Luckily, Facebook has provided to properly test apps without having to use your own account and it’s quite easy.

The easiest way to make new test accounts is inside your application’s settings. Go to your application settings and click on “Developer roles” and at the bottom you will see all the test accounts for that application.

Facebook test account create

Click create and you will be given various test user creation options.

Facebook test account creation options

After you click create a new test account with a random name and information will appear below.

Generated facebook test accounts

Clicking “Switch To” will make you start using Facebook as that user. You can think of each test user as a full fledged Facebook user each with their own set of permissions, authorizations and friendships. This is a great way to test your authorization flow or open graph posts without clogging up your own feed.

If you need a lot of users with a wide array of options you don’t have to create test accounts this way. Test accounts can also be created through the graph api with just a few api calls. See this article on Facebook for more information.

Authenticating with the Facebook Graph API

There are tons of libraries out there that will handle authenticating with Facebook for you, but sometimes its good to know what goes on under the hood. Facebook’s Graph API uses the OAuth2 workflow to generate and pass around access tokens.

Facebook currently has two different ways of doing this. The more traditional way of doing this includes:

OAuth2 workflow

I’m going to show you how to authenticate with Facebook, all you’ll need is a Facebook app, curl, and this code snippet to receive the acces grant code and access tokens from Facebook.

First you’ll need to generate the url you would redirect a user to authenticate with your app. I don’t have any permissions defined, but if you need specific permissions add them to the “scope” parameter in the url.

Once you visit that url and authorize your app, your browser should redirect to the url you specified with a code like this:

Now you can use that code to get an access token by visiting a similar url as the first.

You should see two values, an access token and an expire time. The expire time is how long the access token is valid for in seconds.

Now you can make requests through the  graph API as such:


  • If you are getting an “Error validating verification code” message, see this blog post on how to fix it.
  • If you are getting an error about the redirect_uri not being owned by the application, make sure your redirect_uri is the same domain you have set in your application settings.

Fixing Facebook error “Error validating verification code”

I recently came across this error trying to write another blog post and it really made me rip my hair out. I kept getting an error validating verification code message.

To fix this and to be safe, just make sure all your redirect_uri’s have a trailing slash and you should be good. For example:


Turns out somewhere through the oauth process Facebook adds a trailing slash to your redirect uri. If you don’t have it there in the access token request, the above error will be thrown. Hopefully this will help people out there avoid some headache.

How to hook into the Facebook like button events

Within the Facebook javascript sdk are some events you can bind to regarding the like and unlike actions of like buttons. These events are really easy to hook into and you don’t need to load any additional libraries or have an app associated to your like buttons.

The two events are “edge.create” and “edge.remove”. These two events need to be subscribed to in a fbAsyncInit function in the window like in this example:

The event callback will pass the URL of the liked or unliked button. If you no longer want want this event to fire you can unsubscribe to the two events above with “FB.Event.unsubscribe(eventname, callback)“.

The full example of this is available in this gist.

One issue I have noticed is that, at least for, these events took a long time to fire off. This is probably due to all the server back and forth that goes on since the like button is in an iframe. This may cause issues if a user likes something and then changes the page, something to keep in mind.