unable to 'authorize' user with Facebook API after they have 'approved' application?
When a facebook user tries to visit my facebook app, they get prompted with the standard "Approve this app?". The user approves my app. Then, when my code does the following, the answer is always false:
FacebookApp fbApp = new FacebookApp();
CanvasAuthorizer auth开发者_开发技巧orizer = new CanvasAuthorizer(fbApp);
authorizer.Perms = "user_about_me";
if (authorizer.Authorize())
{
JsonObject result = (JsonObject)fbApp.Api("/me");
return Convert.ToInt64((String)result["id"]);
}
else
{
throw new Exception("Unauthorized Facebook API access.");
}
which results in the authorizer.Authorize() always being false and the "Unauthorized Facebook API Access" exception gets thrown.
the user has "approved" my app. so why is this failing, returning false??
i don't even know where to begin to try to debug this problem.
any suggestions?
Have you configured your web.config
file with you App ID and App Secret.
If not put you AppId and Secret like this :
<configuration>
<configSections>
<section name="facebookSettings" type="Facebook.FacebookConfigurationSection" />
</configSections>
<facebookSettings appId="{app id}"
appSecret="{app secret}" />
</configuration>
It is a cookie problem with IE8. Check to see if you get the error in compatibility mode. If not then add this to all the pages
HttpContext.Current.Response.AddHeader("p3p", "CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\"");
精彩评论