我正在尝试允许在移动设备上使用令牌进行身份验证,同时仍将 Web 表单用于 Web 应用程序。我决定使用devise_token_auth。每当我尝试启动应用程序时,我都会收到错误,因为已经定义了会话路径。
错误
ArgumentError: Invalid route name, already in use: 'new_provider_session'
配置/路由.rb
mount_devise_token_auth_for 'Provider', at: 'api/v1/auth'
devise_for :providers, controllers: {} do
get 'providers/sign_in', to: 'web/sessions#new'
delete 'providers/sign_out', to: 'web/sessions#destroy'
end
root to: 'web/welcome#welcome'
devise_for :admins, controllers: {} do
get 'admins/sign_in', to: 'web/sessions#new'
delete 'admins/sign_out', to: 'web/sessions#destroy'
end