class ActionDispatch::Routing::Mapper
def devise_omniauth_callback(mapping, controllers) #:nodoc:
def devise_omniauth_callback(mapping, controllers) #:nodoc: if mapping.fullpath =~ /:[a-zA-Z_]/ raise <<-ERROR does not support scoping OmniAuth callbacks under a dynamic segment u have set #{mapping.fullpath.inspect}. You can work around by passing :omniauth_callbacks` to the `devise_for` call and extract omniauth s to another `devise_for` call outside the scope. Here is an example: vise_for :users, only: :omniauth_callbacks, controllers: {omniauth_callbacks: 'users/omniauth_callbacks'} ope '/(:locale)', locale: /ru|en/ do devise_for :users, skip: :omniauth_callbacks d end current_scope = @scope.dup if @scope.respond_to? :new @scope = @scope.new path: nil else @scope[:path] = nil end path_prefix = Devise.omniauth_path_prefix || "/#{mapping.fullpath}/auth".squeeze("/") set_omniauth_path_prefix!(path_prefix) mapping.to.omniauth_providers.each do |provider| match "#{path_prefix}/#{provider}", to: "#{controllers[:omniauth_callbacks]}#passthru", as: "#{provider}_omniauth_authorize", via: [:get, :post] match "#{path_prefix}/#{provider}/callback", to: "#{controllers[:omniauth_callbacks]}##{provider}", as: "#{provider}_omniauth_callback", via: [:get, :post] end ensure @scope = current_scope end