In this part, I shall show you how to use Facebook Explorer to test the permissions of the Facebook API. If you have not gone through the first two parts, I would suggest you to read both of them, as this article is the continuation of the previous two parts. Now without further ado, let’s get started!
Testing Using Facebook Explorer
Go to the following link:
and log in, and get the access token(as discussed in the part-1). If you do not get the access token, and execute the query, you would get the following exception:
As you can see in number 2 box that the exception message is "An active access token must be used to query information about the current user." This is because there is no Access Token in the box 1(Please refer to the Part-1 to get the access Token).
If you click on the “Get User Access Token,” from the “Get Token” dropdown menu(as shown below),
You will be presented with the all types of permissions as shared below:
As you can see, we have whole list of permissions, some of which we have discussed in the last part.
For now let us choose the following fields:
After selecting all of the above mentioned fields, click on “Get Access Token” button. When you click on “Get Access Token” button, you will be presented with the following window:
This is the permission window. You might have seen this window before. As you can see the fields in the box labeled as 1 is asking for the same permissions which we selected in the previous image. Now click on the “Continue as XYZ” button.
After clicking the “Continue as XYZ” button, you will be given the access Token for the fields which we have checked before. Now we can use the above mentioned fields to get the information about the Facebook profile. The fields command in the Facebook explorer would look like this:
As you can see in the box-1, I have set the three fields: email, birthday, and friends, and below in the Debug Message, there is a JSON which contains the information about all of the above fields. For example, in case of friends, I have 0 friends’ counts in this profile.
That is how you can test the other permissions as well. For more information about other fields, read the official documentation of Facebook API.