I have a problem with Facebook Graph API/SDK .NET.
In my Website a user can log in with his Facebook-Account. I only want to have organizers of public Events to log on to this page.
But when a user logs in, I only get information about his own events, and that's the result I don't want. I want to get the evens of the Facebook-Page of a user (pages like clubs, associations, ...)
How can I get (if exists) a Facebook-Page where the logged in user is admin of, so that i can get events of this page?
Must a Facebook-Page have a 'real' user behind it or is it usual that the page is administrated without an admin user? Is there any way to get the information i want?
public ActionResult FBLogin()
{
var fb = new FacebookClient();
var loginUrl = fb.GetLoginUrl(new
{
client_id = "client_id",
client_secret = "client_secret",
redirect_uri = RedirectUri.AbsoluteUri,
response_type = "code",
scope = "user_events"
});
return Redirect(loginUrl.AbsoluteUri);
}
public ActionResult FBCallback(string code)
{
var facebook = new FacebookClient();
dynamic r = facebook.Post("oauth/access_token", new
{
client_id = "client_id",
client_secret = "client_secret",
redirect_uri = RedirectUri.AbsoluteUri,
code = code
});
var accessToken = r.access_token;
Session["AccessToken"] = accessToken;
facebook.AccessToken = accessToken;
dynamic me = facebook.Get("me/events");
return null;
}
Thanks a lot!
Managed Pages of the user (with the manage_pages
permission): https://developers.facebook.com/docs/graph-api/reference/v2.4/user/accounts
Events of a Page: https://developers.facebook.com/docs/graph-api/reference/v2.4/page/events
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments