Open naseeratevolverstech opened 5 years ago
did you set controllers
in mount_devise_token_auth_for
? what's error? aren't they showing when you do rake routes
?
what is your environment ? if in vanilla rails(non api mode) the syntax will give this error
Unknown Action
Could not find devise mapping for path "api/auth/password/verify-code". This may happen for two reasons: 1) You forgot to wrap your route inside the scope block. For example: devise_scope :user do get "/some/route" => "some_devise_controller" end 2) You are testing a Devise controller bypassing the router. If so, you can explicitly tell Devise which mapping to use: @request.env["devise.mapping"] = Devise.mappings[:user]
it told me to put the routes inside devise scope so I need to do this
devise_for :users, :skip => [:registrations, :passwords, :sessions]
namespace 'api', defaults: {format: 'json'} do
mount_devise_token_auth_for 'User', at: 'user-auth', controllers: {
registrations: 'api/auth/registrations',
sessions: 'api/auth/sessions',
passwords: 'api/users/passwords'
}
# it seems devise_scope can be changed with as :user
devise_scope :user do
post 'api/auth/password/verify-code', to: 'api/users/passwords#verify_code'
post 'api/auth/password/change-password', to: 'api/users/passwords#change_password'
end
end
if I remove the devise_for :users
it give error as in top
this workaround is have another error though
the sign_in
method is giving
wrong number of arguments (given 9, expected 2)
from this block
def serialize_from_session(key, salt)
record = to_adapter.get(key)
record if record && record.authenticatable_salt == salt
end
or sign_in
method
@MaicolBen is sign_in
method is from vanilla devise? because the method is nowhere to be found in this repo
i want to add some routes to passwords controller like given below
post 'api/auth/password/verify_code', to: 'api/users/passwords#verify_code' post 'api/auth/password/change_password', to: 'api/users/passwords#change_password'
i am unable to do that. i have tried following syntex given in a post for routes