For my App, I am trying to set up the Turbolinks Mobile wrapper> . I am running into an issue where I can't sign into the App (and thinking the issues is that I need to modify Devise to get it to switch to XHR to work for the mobile). My sign_in form uses Devise but I can't see the code.
Using:
ruby "2.4.0"
gem "rails", "5.0.2"
gem "turbolinks", "~> 5.0.0.beta"
gem "devise", ">= 4.2.0"
gem "devise-async", git: "https://github.com/mhfs/devise-async", branch: "devise-4.x" # for user authentication
My question is where to I look or what do I need to do to amend DEVISE to have it be able to send the XHR for the turbolinks mobile wrapper?
Right now, it won't sign in and I know (or I am thinking) I need to get DEVISE to switch to XHR but I don't know how.
Suggestions on how to do this? Or recommendations on reference material?
You need to update your devise initializer to accept ajax requests.
config.http_authenticatable_on_xhr = false
config.navigational_formats = ["*/*", :html, :json]
You will probably need to update your registration and session controllers to respond to json also.
format.json { render json: resource }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With