How to authenticate with Devise via AJAX?

Asked

Viewed 262 times

0

I need to do login, for example, on the home of my website using GEM Devise with AJAX. Does anyone know any way?

1 answer

1

I would make a request for the page that generates the login form by ajax.

Then, just send a second request with the data informed by the user, not forgetting the tokens to avoid CSRF (and any other necessary data).

The response to the request must return the authentication cookies that should be used in the next requests.

  • I agree with Bruno, but you will need to override the Devise Registratition link about

Browser other questions tagged

You are not signed in. Login or sign up in order to post.