Getting facebook access token in c#

var fb = new FacebookClient();

dynamic result = fb.Get("oauth/access_token", new
{
      client_id = "MyAppId",
      client_secret = "MyAppSecret",
      redirect_uri = "http://www.facebook.com/connect/login_success.html",
      code = "code"
});

fb.AccessToken = result.access_token;

I use this piece of code to get facebook access token. When I try to login with any account, there is no problem. However, if I try to post something on that account’s wall, I get a error which is;

(OAuthException-#200)(#200) The user hasn’t authorized the application
to perform this action.

Also I want to add that if I get the access token from graph api explorer in developers.facebook.com manually and use it in my code as access token, I can post.

P.S: I gave “publish_actions” permission to the account and nothing is changed.


Source: facebook

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.