Check Facebook login status and get session details using Facebook C# SDK

后端 未结 1 1903
情深已故
情深已故 2021-02-10 23:10

On the front-end, I\'ve initialised FB and login using:

  window.fbAsyncInit = function () {
        FB.init({
            appId: @facebookAppId, // App ID
              


        
相关标签:
1条回答
  • 2021-02-10 23:59
    var client = new FacebookClient(appID, appSecret);
    

    or

    var client = new FacebookClient(accessToken);
    

    You can grab the access token client-side with the javascript SDK and pass it up to the server in a hidden form field (conventional or ajax), or the C# SDK exposes what it finds in the cookie and/or signed request via FacebookWebContext.Current.AccessToken. In the past I have found some timing issues where Facebook did not update the cookie with a new access token/signed request in a timely fashion, which is why I get it in Javascript and post it to the server.

    0 讨论(0)
提交回复
热议问题