Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 698
Matt Bell Avatar asked Mar 30 '11 03:03

Matt Bell


2 Answers

Starting from v6:

var fb = new FacebookClient();
dynamic signedRequest = fb.ParseSignedRequest("app_secret", Request.Params["signed_request"]);
like image 186
prabir Avatar answered Sep 19 '22 00:09

prabir


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.

like image 20
Andy Sinclair Avatar answered Sep 21 '22 00:09

Andy Sinclair