title: Devise omniauth-facebook redirect_uri Url must absolute
body: <p>My Rails app when I tried to integrate <code>gem "omniauth-facebook"</code> with devise, I receive the following error on facebook: <code>The redirect_uri URL must be absolute</code>.</p>
  
  <p>Following were my config</p>
  
  <p>devise.rb</p>
  
  <pre><code>config.omniauth :facebook, "ID", "SECRET",callback_url: "/auth/facebook"
  </code></pre>
  
  <p>My user.rb model:</p>
  
  <pre><code>class User &lt; ActiveRecord::Base
    # Include default devise modules. Others available are:
    # :confirmable, :lockable, :timeoutable and :omniauthable
    devise :database_authenticatable, :registerable,
           :recoverable, :rememberable, :trackable, :validatable, :omniauthable, :omniauth_providers =&gt; [:facebook]
  
    def self.from_omniauth(auth)
          where(provider: auth.provider, uid: auth.uid).first_or_create do |user|
          user.email = auth.info.email
          user.password = Devise.friendly_token[0,20]
          user.name = auth.info.name   # assuming the user model has a name
          user.image = auth.info.image # assuming the user model has an image
        end
      end
  end
  </code></pre>
  
  <p>My routes:</p>
  
  <pre><code>devise_for :users, :controllers =&gt; {:omniauth_callbacks =&gt; "users/omniauth_callbacks"}
  </code></pre>
  
  <p>And Controller OmniauthCallbacksController</p>
  
  <pre><code>class Users::OmniauthCallbacksController &lt; Devise::OmniauthCallbacksController
      def facebook
      # You need to implement the method below in your model (e.g. app/models/user.rb)
      @user = User.from_omniauth(request.env["omniauth.auth"])
  
      if @user.persisted?
        sign_in_and_redirect @user, :event =&gt; :authentication #this will throw if @user is not activated
        set_flash_message(:notice, :success, :kind =&gt; "Facebook") if is_navigational_format?
      else
        session["devise.facebook_data"] = request.env["omniauth.auth"]
        redirect_to new_user_registration_url
      end
    end
  
    def failure
      redirect_to root_path
    end
  end
  </code></pre>
  
  <p>What am I missing here?</p>