facebook-csharp-sdk/facebook-csharp-sdk — Issue #63: Getting a 400 error when deauthorizing app
Author: ntotten
Created: 2012-02-06 19:36:06+00:00
State: open

Using the Facebook C# API release version from 12/20/2011, I'm calling the facebook client Delete command with "/{facebook id}/permissions" I get a 400 Bad request returned to me. I've tried the following variations too: "{facebook id}/permissions", "/{app id}/permissions", "{app id}/permissions", "/{facebook id}/permission", "me/permissions" and "/{app id}/permission". I've issues other delete commands (such as deleting a comment, removing a like, and deleting a feed posting) thru the C# API with success.

This documentation reference says you're to issue a delete command to {profile id}/permissions

https://developers.facebook.com/docs/reference/rest/auth.revokeAuthorization/

I've tried using {facebook id}/permissions on the delete command via the Graph Api Explorer (https://developers.facebook.com/tools/explorer?method=DELETE) and it works there. So I'm confused why I'm only getting a 400 bad request for the removal of authorization.

at FluentHttp.HttpHelper.OpenRead() in C:\temp\FBSDK-5.4.1.0.src\FacebookCSharpSDK\Source\Facebook\FluentHttp\HttpHelper.cs:line 693
at Facebook.FacebookClient.Api(String path, IDictionary`2 parameters, HttpMethod httpMethod, Type resultType) in C:\temp\FBSDK-5.4.1.0.src\FacebookCSharpSDK\Source\Facebook\FacebookClient.cs:line 458

at Facebook.HttpWebRequestWrapper.GetResponse() in C:\temp\FBSDK-5.4.1.0.src\FacebookCSharpSDK\Source\Facebook\FluentHttp\HttpHelper.cs:line 321
at FluentHttp.HttpHelper.OpenRead() in C:\temp\FBSDK-5.4.1.0.src\FacebookCSharpSDK\Source\Facebook\FluentHttp\HttpHelper.cs:line 672

https://graph.facebook.com:443/me/permissions?access_token=xxxx is the uri being passed into the CreateHttpWebRequest() method. Content type is "application/x-www-form-urlencoded". When _httpWebRequest.GetResponse(); is called, that's when a WebException is thrown in line 680 of HttpHelper.cs.

"The remote server returned an error: (400) Bad Request."

400 Bad Request

Method Not Implemented

Invalid method in request

Which is a strange response because I can run the delete of permissions from the graph API explorer without getting this error.

Migrated from Codeplex: http://facebooksdk.codeplex.com/workitem/5926