我在Rails5应用程序中使用devise和devise_token_auth。 用于Web的devise omniauth(facebook / google)和用于移动应用程序的devise_token_auth。
我定义的路线包括:
scope module: 'api' do
namespace :v1 do
mount_devise_token_auth_for 'User', at: 'auth'
end
end
devise_for :users, :controllers => { :omniauth_callbacks => "callbacks" }, as: 'auth'
resources :users
并获得一些路线
=========================TOKEN AUTH=======================================
new_v1_user_session GET /v1/auth/sign_in(.:format) devise_token_auth/sessions#new
v1_user_session POST /v1/auth/sign_in(.:format) devise_token_auth/sessions#create
destroy_v1_user_session DELETE /v1/auth/sign_out(.:format) devise_token_auth/sessions#destroy
new_v1_user_password GET /v1/auth/password/new(.:format) devise_token_auth/passwords#new
edit_v1_user_password GET /v1/auth/password/edit(.:format) devise_token_auth/passwords#edit
v1_user_password PATCH /v1/auth/password(.:format) devise_token_auth/passwords#update
PUT /v1/auth/password(.:format) devise_token_auth/passwords#update
POST /v1/auth/password(.:format) devise_token_auth/passwords#create
cancel_v1_user_registration GET /v1/auth/cancel(.:format) devise_token_auth/registrations#cancel
new_v1_user_registration GET /v1/auth/sign_up(.:format) devise_token_auth/registrations#new
edit_v1_user_registration GET /v1/auth/edit(.:format) devise_token_auth/registrations#edit
v1_user_registration PATCH /v1/auth(.:format) devise_token_auth/registrations#update
PUT /v1/auth(.:format) devise_token_auth/registrations#update
DELETE /v1/auth(.:format) devise_token_auth/registrations#destroy
POST /v1/auth(.:format) devise_token_auth/registrations#create
new_v1_user_confirmation GET /v1/auth/confirmation/new(.:format) devise_token_auth/confirmations#new
v1_user_confirmation GET /v1/auth/confirmation(.:format) devise_token_auth/confirmations#show
POST /v1/auth/confirmation(.:format) devise_token_auth/confirmations#create
v1_auth_validate_token GET /v1/auth/validate_token(.:format) devise_token_auth/token_validations#validate_token
v1_auth_failure GET /v1/auth/failure(.:format) devise_token_auth/omniauth_callbacks#omniauth_failure
GET /v1/auth/:provider/callback(.:format) devise_token_auth/omniauth_callbacks#omniauth_success
GET|POST /omniauth/:provider/callback(.:format) devise_token_auth/omniauth_callbacks#redirect_callbacks
omniauth_failure GET|POST /omniauth/failure(.:format) devise_token_auth/omniauth_callbacks#omniauth_failure
GET /v1/auth/:provider(.:format) redirect(301)
======================WEB==========================================
new_auth_user_session GET /users/sign_in(.:format) devise/sessions#new
auth_user_session POST /users/sign_in(.:format) devise/sessions#create
destroy_auth_user_session DELETE /users/sign_out(.:format) devise/sessions#destroy
new_auth_user_password GET /users/password/new(.:format) devise/passwords#new
edit_auth_user_password GET /users/password/edit(.:format) devise/passwords#edit
auth_user_password PATCH /users/password(.:format) devise/passwords#update
PUT /users/password(.:format) devise/passwords#update
POST /users/password(.:format) devise/passwords#create
cancel_auth_user_registration GET /users/cancel(.:format) devise/registrations#cancel
new_auth_user_registration GET /users/sign_up(.:format) devise/registrations#new
edit_auth_user_registration GET /users/edit(.:format) devise/registrations#edit
auth_user_registration PATCH /users(.:format) devise/registrations#update
PUT /users(.:format) devise/registrations#update
DELETE /users(.:format) devise/registrations#destroy
POST /users(.:format) devise/registrations#create
new_auth_user_confirmation GET /users/confirmation/new(.:format) devise/confirmations#new
auth_user_confirmation GET /users/confirmation(.:format) devise/confirmations#show
POST /users/confirmation(.:format) devise/confirmations#create
auth_user_google_oauth2_omniauth_authorize GET|POST /omniauth/google_oauth2(.:format) callbacks#passthru
auth_user_google_oauth2_omniauth_callback GET|POST /omniauth/google_oauth2/callback(.:format) callbacks#google_oauth2
auth_user_facebook_omniauth_authorize GET|POST /omniauth/facebook(.:format) callbacks#passthru
auth_user_facebook_omniauth_callback GET|POST /omniauth/facebook/callback(.:format)
但网络路由必须类似
auth_user_google_oauth2_omniauth_authorize GET|POST /users/auth/google_oauth2(.:format) callbacks#passthru
auth_user_google_oauth2_omniauth_callback GET|POST /users/auth/google_oauth2/callback(.:format) callbacks#google_oauth2
auth_user_facebook_omniauth_authorize GET|POST /users/auth/facebook(.:format) callbacks#passthru
auth_user_facebook_omniauth_callback GET|POST /users/auth/facebook/callback(.:format)
当我评论devise_token_auth初始值设定项时,所有网络路由都很好,但是当我打开初始值设定项时-它没有损坏。 devise和token_auth的初始化程序是默认的。
我该如何解决?