2

Closed

Getting a 400 error when deauthorizing app

description

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

<HTML>
<HEAD> <TITLE>400 Bad Request</TITLE> </HEAD> <BODY>
<H1>Method Not Implemented</H1> Invalid method in request<P>
</BODY>
</HTML>

Which is a strange response because I can run the delete of permissions from the graph API explorer without getting this error.
Closed Feb 6, 2012 at 6:36 PM by ntotten

comments

rafekemmis wrote Jan 13, 2012 at 8:17 PM

Did this ever get fixed or did you happen to find a work-around?

electricdominic wrote Jan 13, 2012 at 9:08 PM

Workaround is to do it client-side by way JS SDK's FB.api() call. But it would be nice to be able to do it via the app serverside.