ActionController::InvalidAuthenticityToken in RegistrationsController#create

前端 未结 8 1474
后悔当初
后悔当初 2020-11-29 19:39

Hi I am using Devise for my user authentication suddenly my new user registration was not working.

this was error I am getting.

ActionController::In         


        
8条回答
  •  醉酒成梦
    2020-11-29 20:22

    If you're using just an API you should try:

    class ApplicationController < ActionController::Base
      protect_from_forgery unless: -> { request.format.json? }
    end
    

    http://edgeapi.rubyonrails.org/classes/ActionController/RequestForgeryProtection.html#method-i-protect_against_forgery-3F

提交回复
热议问题