How do I parse a signed request in Facebook C# SDK?

吃可爱长大的小学妹 提交于 2019-12-18 16:59:39

问题


I'm trying to create a FB credits callback page, and need to parse the signed request coming in. I can write something manually, but it seems like this is something that should be in the SDK somewhere but I can't seem to find it in the API.


回答1:


Simply call the static method Parse on the FacebookSignedRequest class as shown below (with your app secret, and the signed request):

var DecodedSignedRequest = FacebookSignedRequest.Parse(FacebookContext.Current.AppSecret, SignedRequest);

Now you will see all the data (in JSON format) from the signed request in DecodedSignedRequest.




回答2:


Starting from v6:

var fb = new FacebookClient();
dynamic signedRequest = fb.ParseSignedRequest("app_secret", Request.Params["signed_request"]);


来源:https://stackoverflow.com/questions/5481669/how-do-i-parse-a-signed-request-in-facebook-c-sharp-sdk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!