简体   繁体   中英

(OAuthException) (#200) exception while posting to facebook wall using facebook c#sdk

i am working on asp.net mvc3 and i am using facebook c# sdk to post on fb wall . i get following error while trying to post on wall.

(OAuthException) (#200) The user has not granted the application the permission to automatically publish feed stories

please see the code i used .

string appAccessToken = "accessstoken"; //this token i got after creatting app in fb developer.

        FacebookClient fb = new FacebookClient(appAccessToken);
        Dictionary<string, object> parameters = new Dictionary<string, object>()
                                                    {
                                                        {"description", "Testbeskrivning"},
                                                        {"link", ""},
                                                        {"name", "Testtitel" }

                                                    };

        fb.Post("myfbid/feed", parameters);

That's because you haven't added the right permission when you get the LoginUrl: You will have to add the following permission: publish_stream .

var oAuthClient = new FacebookOAuthClient(FacebookApplication.Current);
oAuthClient.RedirectUri = new Uri(redirectUrl);

Dictionary<String, Object> oParams = new Dictionary<String, Object>();
oParams.Add("scope", "publish_stream");

var loginUri = oAuthClient.GetLoginUrl(oParams);

For the most Facebook features you need the permissions from the users. Check the following page for all the current permissions:

https://developers.facebook.com/docs/reference/api/permissions/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM