title: Facebook C# SDK OAuth Exception "ClientID required"
body: <p>This question is, I think, similar <a href="http://facebook.stackoverflow.com/questions/7349362/facebook-c-sdk-signed-request-is-null-in-isauthorized">to my previous one</a>.
  Using the latest C# Facebook SDK on .NET 4 I get an Exception with the message "ClientID required" with the following code on the last line:</p>
  
  <pre><code>    var app = new DefaultFacebookApplication();
      app.AppId = "appId";
      app.AppSecret = "secret";
      var fb = new FacebookWebContext(app);
      fb.IsAuthenticated();
  </code></pre>
  
  <p>App ID and secret are properly set. The stack trace of the exception is the following:
  System.Exception occurred</p>
  
  <pre><code>  Message=ClientID required.   Source=Facebook   StackTrace:
         at Facebook.FacebookOAuthClient.BuildExchangeCodeForAccessTokenParameters(IDictionary`2 parameters, String&amp; name, String&amp; path)
         at Facebook.FacebookOAuthClient.ExchangeCodeForAccessToken(String code, IDictionary`2 parameters)
         at Facebook.FacebookSession.get_AccessToken()
         at Facebook.FacebookSession.get_Expires()
         at Facebook.Web.FacebookWebContext.IsAuthenticated()
         at Piedone.FacebookTest.Authorize()   InnerException:
  </code></pre>
  
  <p>On the client side I'm using the JS SDK, initialized as following:</p>
  
  <pre><code>            FB.init({
                  appId: appId,
                  status: true, // check login status
                  cookie: true, // enable cookies to allow the server to access the session
                  xfbml: true, // parse XFBML
                  oauth: true // enable OAuth 2.0
              });
  </code></pre>
  
  <p>The users gets properly logged in with the JS login() method, as the alert in the following piece of code runs:</p>
  
  <pre><code>        FB.login(function (response) {
              if (response.authResponse) {
                  alert("logged in");
              } else {
                  alert('User cancelled login or did not fully authorize.');
              }
          }, { scope: scope });
  </code></pre>
  
  <p>In the app settings on Facebook both the "Forces use of login secret for OAuth call and for auth.login" and "Encrypted Access Token" are turned on. As far as I know all this should enable the use of the OAuth 2 authentication.
  Anybody has an idea what am I doing wrong? There really can't be any error in these few lines of code...</p>
  
  <p>Thanks in advance for any help!</p>
  
  <p><strong>Edit:</strong>
  The AccessToken property of FacebookWebContext throws the same error and HttpContext.CurrentNotification does:</p>
  
  <pre><code>CurrentNotification '(_facebookWebContextCache.HttpContext).CurrentNotification' threw an exception of type 'System.PlatformNotSupportedException'  System.Web.RequestNotification {System.PlatformNotSupportedException}
  This operation requires IIS integrated pipeline mode.
  </code></pre>
  
  <p>Since I must run the program from Visual Studio with its Development Server (as I'm currently developing the application) there is no way anything can be done about the latter exception, I suppose. Actually I also tried with Webmatrix's IIS express, but the problem persists.
  It's also interesting, that in the FacebookWebContext the settings (app id, secret) are correctly set as well, the user Id and the signed request is also there...</p>
  
  <p><strong>Edit 2:</strong>
  I also get the same error when using the SDK source. It looks that AccessToken and in the Session the Expires property throw the exception. I don't know if this is connected to the httpcontext issue above.</p>