ActionController InvalidAuthenticityToken in Api::V1::UsersController#create
You need to make the following change in application_controller.rb
Change
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
end
to
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :null_session
end
EDIT
Better way is to skip the authentication for a specific controller
class Api::V1::UsersController < ApplicationController
skip_before_action :verify_authenticity_token
respond_to :json
# ...
end