Getting facebook access token in c#

匿名 (未验证) 提交于 2019-12-03 02:29:01

问题:

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 an 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.

回答1:

Can you verify that your have requested permissions using /{user-id}/permissions ?

See https://developers.facebook.com/docs/facebook-login/permissions/v2.4 for details.



易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!