I have an app that’ll be used in a Facebook page tab for which I’ll be requesting basic permissions.
I’m using ASP.NET MVC2 with ASP.NET 3.5.
I’m using the following Action Attributes:
[HttpPost]
[CanvasAuthorize]
public ActionResult Index(string signed_request)
{
ViewData["section"] = "post";
FacebookPageModel page = new FacebookPageModel();
if (!string.IsNullOrEmpty(signed_request))
{
string signedRequest = Request.Form["signed_request"];
var DecodedSignedRequest =
FacebookSignedRequest.Parse(
((FacebookConfigurationSection)
ConfigurationManager
.GetSection("facebookSettings"))
.AppSecret,
signed_request);
var SignedRequestData = DecodedSignedRequest.Data;
var RawRequestData = (IDictionary<string, object>)SignedRequestData;
// ok, start getting the data
page.user_id = FacebookWebContext.Current.UserId.ToString();
if (RawRequestData.ContainsKey("page") == true)
{
Facebook.JsonObject RawPageData =
(Facebook.JsonObject)RawRequestData["page"];
if (RawPageData.ContainsKey("liked") == true)
{
page.UserLikesThisPage = (bool)RawPageData["liked"];
}
}
if (RawRequestData.ContainsKey("app_data") == true)
{
page.app_data = RawRequestData["app_data"].ToString();
}
}
return View(page);
}
public class FacebookPageModel
{
public Dictionary<string, string> SignedRequestParameters { get; set; }
public bool UserLikesThisPage { get; set; }
public string app_data { get; set; }
public string user_id { get; set; }
public IEnumerable<TwitterSearchResultsModel> tweets { get; set; }
}
web.config:
<facebookSettings
appId="221731264504206"
appSecret="blah-blah-blah"
canvasUrl="http://url-of-canvas-page-tab/"
canvasPage="http://url-of-canvas-page-tab/" />
Calling CanvasAuthorize without any other parameters seems to request Basic permissions, which is what I want. The problem is that after clicking Allow, the forward url is sending me to the user’s profile page, not to my page tab.
How do I configure my app to forward the user back to the calling page after Allowing the requested permissions?
Thanks,
Scott
It turns out that [CanvasAuthorize] has some additional parameters I can use:
I know it is strange I didn’t know this, since C# Facebook SDK is so well documented. :^)
But it is Free, so who am I to complain, right?
Thanks.