I am trying to upgrade from V5.3.2 to V6 SDK. I have an ASP.NET 4.0 Canvas application. I noticed that now there is no longer facebook.web.dll (which I previously used), and found this information:
<P β Removing Facebook.Web.dll and Facebook.Web.Mvc.dll Starting with v6, we depreciate Facebook.Web.dll and Facebook.Web.Mvc.dll and will no longer provide it. ... Starting with v6, you will need to use the Javascript Facebook SDK to get the access token and transfer it to the server using a secure https connection or use the Facebook OAuth login dialog. The signed decoding request (ParseSignedRequest / TryParseSignedRequest) has been moved to FacebookClient.
var fb = new FacebookClient(); dynamic signedRequest = fb.ParseSignedRequest("app_secret", Request.Params["signed_request"]);
<<<<( http://blog.prabir.me/post/Facebook-CSharp-SDK-Glimpse-into-the-Future.aspx ) So everything is fine and good. I used to have this in my code:
protected void Page_Load(object sender, EventArgs e) { var auth = new CanvasAuthorizer { Permissions = new[] { "user_about_me" } }; if (auth.Authorize()) { ShowFacebookContent(); } }
To change it, I already got the Javascript SDK for downloading and registering my user:
<div id="fb-root"></div> <script type="text/javascript"> FB.init({ appId: 'xxxxxxx', cookie: true, status: true, oauth: true }); FB.getLoginStatus(function (response) { if (response) { alert(response.authResponse.accessToken); } }); </script>
I tested this and successfully logged in. But how do I get it to postback and call the server-side method that it used to call (ShowFacebookContent)? I assume that all I do will have to pass accessToken or SignedRequest for fb.ParseSignedRequest to work, and on the server we can generate FacebookClient.
I guess a few people will be in a similar situation trying to migrate from facebook.web.dll, so any guide would be really great.
source share