1

我正在尝试使用 Devise 和 Omniauth 来允许用户使用 Rails 3.2 应用程序登录多个提供商。我让它工作,但只有当它转到控制器中的 twitter、facebook 或 tumblr 方法时,我希望所有提供程序都转到 create 方法。这就是我有这样做的路线: match '/auth/:provider/callback' => 'authentications#create'

  resources :authentications

  match '/auth/:provider/callback' => 'authentications#create'
  devise_for :users, path_names: {sign_in: "login", sign_out: "logout"},
    controllers: {omniauth_callbacks: "authentications"}

  root to: 'authentications#index'

我的 rake 路线显示:

 user_omniauth_authorize        /users/auth/:provider(.:format)        authentications#passthru {:provider=>/twitter|facebook|tumblr/}
  user_omniauth_callback        /users/auth/:action/callback(.:format) authentications#(?-mix:twitter|facebook|tumblr)

我希望 user_omni_auth_callback 路由到 authentications#create 而不是特定的提供者。使用当前设置,我得到“无法为 AuthenticationsController 找到操作 'twitter'”,因为我不包括它。最好的方法是什么?

4

0 回答 0