Skip to content

Instantly share code, notes, and snippets.

@jirikolarik
Last active December 27, 2015 00:19
Show Gist options
  • Save jirikolarik/7237231 to your computer and use it in GitHub Desktop.
Save jirikolarik/7237231 to your computer and use it in GitHub Desktop.
Devise + OmniAuth in engine
MyEngine::Engine.routes.draw do
devise_scope :user do
providers = Regexp.union(Devise.omniauth_providers.map(&:to_s))
match 'users/auth/:provider',
constraints: { provider: providers },
to: 'omniauth_callbacks#passthru',
as: :omniauth_authorize,
via: [:get, :post]
match 'users/auth/:action/callback',
constraints: { action: providers },
to: 'omniauth_callbacks',
as: :omniauth_callback,
via: [:get, :post]
end
devise_for :users, class_name: 'MyEngine::User', module: :devise
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment