title: Omniauth-facebook keeps reporting invalid_credentials
body: <p>I am trying to implement omniauth-facebook as described in Railscast #360 and have run into quite a roadblock.  When I click on the signin link, I get the desired popup asking me to input my facebook credentials, but when I submit, I get an OmniAuth::Strategies::OAuth2::CallbackError error.  In the apache logs, this is printed: (facebook) Authentication failure! invalid_credentials: OmniAuth::Strategies::OAuth2::CallbackError, OmniAuth::Strategies::OAuth2::CallbackError</p>
  
  <p>here is the relevant code:</p>
  
  <p><strong>omniauth.rb</strong></p>
  
  <pre><code>OmniAuth.config.logger = Rails.logger
  
  Rails.application.config.middleware.use OmniAuth::Builder do
    provider :facebook, ENV['FACEBOOK_APP_ID'], ENV['FACEBOOK_SECRET']
  end
  </code></pre>
  
  <p><strong>sessions_controller.rb</strong></p>
  
  <pre><code>class SessionsController &lt; ApplicationController
    def create
      user = User.from_omniauth(env["omniauth.auth"])
      session[:user_id] = user.id
      redirect_to root_url
    end
  
    def destroy
      session[:user_id] = nil
      redirect_to root_url
    end
  end
  </code></pre>
  
  <p><strong>application.html.erb</strong></p>
  
  <pre><code>&lt;div id="fb-root"&gt;&lt;/div&gt;
  &lt;script&gt;        
  window.fbAsyncInit = function() {
      FB.init({
          appId      : '(**my app id**)', // App ID
          status     : true, // check login status
          cookie     : true // enable cookies to allow the server to access the session
      });
  
      $('#sign_in').click(function(e) {
          e.preventDefault();
          return FB.login(function(response) {
              if (response.authResponse) {
                  return window.location = '/auth/facebook/callback';
              }
          });
      });
  
      return $('#sign_out').click(function(e) {
          FB.getLoginStatus(function(response) {
              if (response.authResponse) {
                  return FB.logout();
              }
          });
          return true;
      });
  };
   &lt;/script&gt;
  </code></pre>
  
  <p>Am I missing something simple?  I've been searching for a solution for the last few days.</p>