So here is what I am trying to do. I have created my Facebook application and I have been able to use the Graph API explorer to specify the application in the top right.
Some more detailed information, I am using C# to code in the functionality to our in-house app to get this to work.
After that I go to the url section and type in the following address.
https://graph.facebook.com/MyCompanyPage
Then hit submit. It will navigate and display the information for that page below in the explorer. Well then to get my access_token for my app I go up and hit Get Access Token->Specify my Extended Permissions->Then hit Get Access Token again. All that is well and good and I can post to Facebook using our Facebook app successfully.
The problem is that the access_token is expiring and I am using a manual method of retrieval to get the access token.
Here is what I have tried doing using one of the examples from GIT.
FacebookClient client = new FacebookClient();
dynamic parameters = new ExpandoObject();
parameters.client_id = "MYAPPID"; // Or does this need to be my CompanyPage ID??
parameters.redirect_uri = "https://www.facebook.com/connect/login_success.html";
// The requested response: an access token (token), an authorization code (code), or both (code token).
parameters.response_type = "token";
// list of additional display modes can be found at http://developers.facebook.com/docs/reference/dialogs/#display
parameters.display = "popup";
// add the 'scope' parameter only if we have extendedPermissions.
parameters.scope = "publish_stream,manage_pages,status_update";
// when the Form is loaded navigate to the login url.
Uri LoginURL = client.GetLoginUrl(parameters);
// whenever the browser navigates to a new url, try parsing the url.
// the url may be the result of OAuth 2.0 authentication.
FacebookOAuthResult oauthResult;
if (client.TryParseOAuthCallbackUrl(LoginURL, out oauthResult)) {
// The url is the result of OAuth 2.0 authentication
} else {
// The url is NOT the result of OAuth 2.0 authentication.
}
Now this works for me when I am trying to obtain an access token for the app for myself. However, I need the behavior to operate in the same way that it does for the Graph API Explorer. The reason I need it to work like the Explorer is because I wanted to make posts using the Facebook application under the actual Company Page, so it appears that the Company Page is actually making the Facebook post and not a user. Like I have said above I am able to successfully do this through the Graph API Explorer but haven't been successful doing this in C#.
in order to use Graph API on behalf of a Page, you need to get Page access token - see here for more details: https://developers.facebook.com/docs/authentication/pages/