Q:

Setting up devise+omniauth in rails, keep getting a routing error after 'login'

So I've been working on a fairly simple rails 4 app and I've reached the point where I need to add user authentication. In particular, I want to use Google Apps (and only google apps) authentication via a combination of devise and omniauth. Now, devise has a tutorial that supposedly tells you how to set something like that up. After installing devise and making the suggested changes in the tutorial, everything seemed great. I clicked my sign-in link and was properly sent off to google for authentication. However, after I supply my credentials I'm immediately greeted with a routing error:
uninitialized constant Users
Which is confusing. From what I understand, that means that the controller is missing... but I definitely have users_controller.rb and it's where it should be. Barring that, I have no clue.
Here's my route.rb for reference:
  resources :instances, :users

  devise_for :users, :controllers => { :omniauth_callbacks => 'users/omniauth_callbacks' }

  # authentication routes
  devise_scope :user do
    get 'sign_in', :to => 'devise/sessions#new', :as => :new_user_session
    get 'sign_out', :to => 'devise/sessions#destroy', :as => :destroy_user_session
  end

  root to: 'instances#index'

And here's the result of rake routes:
                 Prefix Verb     URI Pattern                            Controller#Action
              instances GET      /instances(.:format)                   instances#index
                        POST     /instances(.:format)                   instances#create
           new_instance GET      /instances/new(.:format)               instances#new
          edit_instance GET      /instances/:id/edit(.:format)          instances#edit
               instance GET      /instances/:id(.:format)               instances#show
                        PATCH    /instances/:id(.:format)               instances#update
                        PUT      /instances/:id(.:format)               instances#update
                        DELETE   /instances/:id(.:format)               instances#destroy
                  users GET      /users(.:format)                       users#index
                        POST     /users(.:format)                       users#create
               new_user GET      /users/new(.:format)                   users#new
              edit_user GET      /users/:id/edit(.:format)              users#edit
                   user GET      /users/:id(.:format)                   users#show
                        PATCH    /users/:id(.:format)                   users#update
                        PUT      /users/:id(.:format)                   users#update
                        DELETE   /users/:id(.:format)                   users#destroy
user_omniauth_authorize GET|POST /users/auth/:provider(.:format)        users/omniauth_callbacks#passthru {:provider=>/google_apps/}
 user_omniauth_callback GET|POST /users/auth/:action/callback(.:format) users/omniauth_callbacks#(?-mix:google_apps)
       new_user_session GET      /sign_in(.:format)                     devise/sessions#new
   destroy_user_session GET      /sign_out(.:format)                    devise/sessions#destroy
                   root GET      /                                      instances#index

Also of note is that I'm running rails 4 and devise 3.0.0.rc (because it's rails 4 compatible)
Let me know if there's anything else you need, pretty much everything else that is relevant is in the tutorial thing though.

A:

You're problem lies here: :omniauth_callbacks => 'users/omniauth_callbacks'
'users/omniauth_callbacks' translates to Users::OmniauthCallbacksController. While your application does have a User model and a UserController, you haven't declared a constant which defines a Users namespace.
You'll need to add a controller in that namespace to handle the callback:
# app/controllers/users/omniauth_callbacks_controller.rb

class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
  # action names should match the names of the providers
  def facebook; end
  def twitter; end
  def github; end
  ...
end

