I try to create app in rails, which would be regular web application and also an api for mobile application written in react native. I take advantage of "devise token auth" gem along wiht "devise".
I added gems to Gemfile and ran bundle. Next I ran
rails g devise_token_auth:install User auth
. Finally I changed routes:
Rails.application.routes.draw do
devise_for :users
namespace :api do
scope :v1 do
mount_devise_token_auth_for 'User', at: 'auth'
end
end
end
Fortunately regular sign_in and sign_up work for web app, however when I try to send request to api using curl:
curl -H "Content-Type: application/json" -X POST -d '{"email":"[email protected]","password":"aaaaaaaa"}' http://localhost:3000/api/v1/auth/sign_in
I get message "can't verify CSRF token authenticity"