title: implementing a login with facebook button in asp.net mobile
body: <p>There is something very obvious that I'm missing.  I've implemented the Log in with Facebook tutorial from <a href="http://www.asp.net/mvc/overview/getting-started/using-oauth-providers-with-mvc" rel="nofollow">asp.net</a>, then I created a mobile MVC 4 web site.</p>
  
  <p>I created an AuthConfig which calls:</p>
  
  <pre><code>OAuthWebSecurity.RegisterFacebookClient(
      appId: "...",
      appSecret: "...");
  </code></pre>
  
  <p>then, in Views/Home/Login.cshtml, I created a button</p>
  
  <pre><code> &lt;li&gt;@Html.ActionLink("Log in with Facebook", "FacebookLogin")&lt;/li&gt;
  </code></pre>
  
  <p>and lastly, in /Controllers/HomeController.cs I added:</p>
  
  <pre><code>    public ActionResult FacebookLogin()
      {
          return new FacebookLoginResult(this.Url.Action("ExternalLoginCallback"));
      }
  
      [AllowAnonymous]
      public ActionResult ExternalLoginCallback(string returnUrl)
      {
          AuthenticationResult result = OAuthWebSecurity.VerifyAuthentication(Url.Action("ExternalLoginCallback", new { ReturnUrl = returnUrl }));
          if (!result.IsSuccessful)
          {
       ...
  </code></pre>
  
  <p>(For the sake of completeness, FacebookLogin result is a class that inherits from ActionResult and calls</p>
  
  <pre><code>    OAuthWebSecurity.RequestAuthentication("facebook", "/Home/ExternalLoginCallback");
  </code></pre>
  
  <p>in the ExecuteResult() override.  When I step through it, I see the button being pressed, I see ExecuteResult() being called, but it never makes it to ExternalLoginCallback().  The whole process simply errors out.  There is likely something very easy and very obvious that I'm missing, but barring that, how can I enable more extended logging to see where it is breaking down?  I'm using IIS Express for both the MVC site that worked and the MVC mobile site that doesn't.</p>
  
  <p>Thanks!</p>