This question may be a bit trivial, but I'm new in rails. I use Knock to authenticate api users with JWT, and my routes.rb
looks like this:
Rails.application.routes.draw do
resources :news_articles
mount Knock::Engine => "/sessions"
end
According to knock docs, it creates a route 'POST /sessions/auth_token', how can i alias 'POST /sessions/auth_token' to just 'POST /sessions' via rails conf?
The latest version (1.5) of knock doesn't need the engine to be mounted anymore.
Instead you can run the token controller generator
$ rails generate knock:token_controller user
This will add the following in config/routes.rb
post 'user_token' => 'user_token#create'
You can simply modify this route to fit your needs.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.