An example todo api using Phauxth authentication with the Phoenix web framework.
mix deps.get
mix ecto.setup
iex -S mix phx.server
With Curl, the above example would be:
curl --request POST \
--url http://localhost:4000/api/sessions \
--header 'content-type: application/json' \
--data '{
"session": {
"email": "[email protected]",
"password": "password"
}
}'
The response will be in the form {"access_token": token}
Then you can access the /users route by running this command (replace token with the value of the token):
curl --request GET \
--url http://localhost:4000/api/users \
--header 'content-type: application/json' \
--header 'Authorization: token' \
Content type
Image
Digest
Size
349.4 MB
Last updated
almost 7 years ago
docker pull javier1/todo-app