lundi 10 avril 2017

How to log in using REST API?

Im currently trying to build a REST API on ruby on rails.

After logging in (not using the REST API), I am able to use to the commands I have made in the controllers.

But how can I log in using REST API?

So something like when I type

http://localhost:3000/api/v1/login/'test@test.com','12345'.

the test user can login, and after that, if I choose to do something like

http://localhost:3000/api/v1/viewuser/2

I get a JSON object which shows user with ID - 2 details.

If I do any of the Get requests right now without logging in, i get message saying 'You have to sign in / sign up first'.

The project currently uses Devise to authenticate.

Aucun commentaire:

Enregistrer un commentaire