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

I'm trying out the Facebook API. I'm getting this error that I'm not authorized to perform this action. I have accepted all the pop-ups that came when i run the program. Anyone got a quick solution for this?


using Facebook;

        public void CheckAutorization()
        {
            string app_Id = "xxxxxxxxxxxxxxx";
            string app_secret = "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy";
            string scope = "manage_pages,publish_actions,publish_pages";

            if (Request["code"] == null)
            {
                Response.Redirect(string.Format(
                    "https://graph.facebook.com/oauth/authorize?client_id={0}&redirect_uri={1}&scope={2}",
                    app_Id, Request.Url.AbsoluteUri, scope));
            }
            else
            {
                Dictionary<string, string> tokens = new Dictionary<string, string>();

                string url = string.Format("https://graph.facebook.com/oauth/access_token?client_id={0}&redirect_uri={1}&scope={2}&code={3}&client_secret={4}",
                    app_Id, Request.Url.AbsoluteUri, scope, Request["code"].ToString(), app_secret);

                HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;

                using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
                {
                    StreamReader reader = new StreamReader(response.GetResponseStream());

                    string vals = reader.ReadToEnd();

                    foreach (string token in vals.Split('&'))
                    {
                        //meh.aspx?token1=steve&token2=jake&...
                        tokens.Add(token.Substring(0, token.IndexOf("=")),
                            token.Substring(token.IndexOf("=") + 1, token.Length - token.IndexOf("=") - 1));
                    }
                }

                string access_token = tokens["access_token"];

                var client = new FacebookClient(access_token);

                client.Post("/me/feed", new { message = "Is there anyone out there? :) Can i get a whoop whoop" });
            }
        }
OffshorentAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Randy DownsOWNERCommented:
Maybe this will help.

Had to change the scope string scope = "publish_stream, manage_pages" to string scope = "publish_stream, publish_actions";
OffshorentAuthor Commented:
Thank you for the reply Randy Downs.
I changed the scope string scope = "publish_stream, manage_pages"
to
string scope = "publish_stream, publish_actions";


But  the same error exists  .Please advise
Randy DownsOWNERCommented:
Maybe this will help.

Once an app has detected that someone has denied some or all permissions, it may pass them back through the login flow once and request any required permissions. However, this is a poor experience and should be avoided if possible. If someone is actively choosing not to grant a specific permission to an app they are unlikely to change their mind, even in the face of continued prompting. Instead, do the following:

    If a person declines the login dialog have a clear and upfront explanation about why you are requesting each permission. Then let them click or tap to opt back in to the permission request dialog. Do not immediately redirect them into a permission request dialog without an explanation.

    If someone has declined a permission for your app, the login dialog won't let your app re-request the permission unless you pass auth_type=rerequest along with your request.

    For cases where someone has granted some permissions but not others, only prompt for missing permissions at the point at which they are needed. For example, if your app posts stories to Facebook, only request publish_actions when they ask to publish a story.

    Unless the permissions you are requesting in the login dialog are critical to the functionality of your app and a feature doesn't work without them, let people continue using your app without the permissions.

You may receive Developer Alerts if your app repeatedly directs users to permissions dialogs after they deny permissions. To stop receiving these alerts, follow these guidelines

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.