jeudi 8 septembre 2016

How can I authenticate with devise if created an admin panel on rails-api only application

I have a api only(beacause of short sightedness) application it uses rails-api gem. I am trying to create admin panel on it.

I am trying to authenticate user with Devise authentication but it wont allow it as rails-api removes helpers, layouts and not sure which other classes and methods.

When trying to submit login form it says undefined method protect_against_forgery?

I am trying this

class AdminsSessionsController < Devise::SessionsController
  # helper_method :protect_against_forgery?,:form_authenticity_token,:request_forgery_protection_token
  layout 'empty'

  def protect_against_forgery?
    false
  end

  def form_authenticity_token
    nil
  end

  def request_forgery_protection_token
  end


end

Aucun commentaire:

Enregistrer un commentaire