Facebook App access token

App access token

You can get an app access token in three ways, but all leads to the same result (you can access the same types of information). An app access token will only expire if your change the app secret for the application.

A)
If you have already created an app, you can go to this page and pick an app access token for the desired application.

B)
You can get an app access token by calling the code below with your app id and app secret.

// Information about your app
long appId = 123456789;
string appSecret = "bacon";

// Initialize the OAuth client (no calls are made at this point)
FacebookOAuthClient client = new FacebookOAuthClient(appId, appSecret);

// Get an app token for the application (makes a call to the Facebook API)
string accessToken = client.GetAppAccessToken();

C)
It is harder to find documentation about this method, so it may not continue to work. However a very simple method to create an app access token is to put the app id and app secret together in this way:

app id|app secret

What data can be accessed?

Not all methods in the API can be accessed using an app access token. For instance the /me/statuses method requires a user access token. I don't have a list of what methods that can be called with an app access token, but you should be able to access most public data.

Example

Having obtained an access token, you're now ready to fetch data from the Facebook Graph API. As an example, you can fetch the posts of a user or page like this:

// Initialize the service from the access token
FacebookService service = FacebookService.CreateFromAccessToken(accessToken);

// Get the posts from the AviationHumor page
FacebookPostsResponse response = service.Posts.GetPosts("AviationHumor");

// Loop through the posts
foreach (FacebookPost post in response.Body.Data) {

    // Do something with the post

}