rails-devise-cors-jwt-example
rails-devise-cors-jwt-example copied to clipboard
An example of a CORS configured rails 4 app that extends devise to pass a JWT during authentication.
== README
A simple example of configuring CORS and overriding Devise to pass a JWT when authenticating remotely via JSON.
You can view a screencast explaining this in detail here: https://www.youtube.com/watch?v=_CAq-F2icp4
Here is an example of a post request to create an account:
curl -H "Content-Type: application/json"
-X POST
-d '{"user":{"email":"[email protected]","password":"12345678","password_confirm":"12345678"}}'
http://localhost:3000/users.json
And to authenticate:
curl -H "Content-Type: application/json"
-X POST
-d '{"user": {"email":"[email protected]","password":"12345678"}}'
http://localhost:3000/users/sign_in.json