Simple demo project of a keychain using JWT
https://github.com/nodes-vapor/jwt-keychain
CURL
curl -X POST -H "Content-Type: multipart/form-data" -F "name=Casper" -F "email=cr@nodes.dk" -F "password=TestTest123" "http://0.0.0.0:8080/api/users"
Response
{
"created_at": "2017-01-12T20:35:38+0100",
"deleted_at": null,
"email": "cr@nodes.dk",
"id": 1,
"name": "Casper",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE0ODQyNTM3MzIsInN1YiI6Im51bWJlcigxKSJ9.06X3LOa20U/Ezpo4qdKbFHd5xjqBBtM+Pfkjob+Fyqk=",
"updated_at": "2017-01-12T20:35:38+0100"
}
CURL
curl -X POST -H "Content-Type: multipart/form-data" -F "email=cr@nodes.dk" -F "password=TestTest123" "0.0.0.0:8080/api/users/login"
Response
{
"created_at": "2017-01-12T20:35:38+0100",
"deleted_at": null,
"email": "cr@nodes.dk",
"id": 1,
"name": "Casper",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE0ODQyNTM3MzIsInN1YiI6Im51bWJlcigxKSJ9.06X3LOa20U/Ezpo4qdKbFHd5xjqBBtM+Pfkjob+Fyqk=",
"updated_at": "2017-01-12T20:35:38+0100"
}
CURL
curl -X GET -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE0ODQyNTUwNDMsInN1YiI6Im51bWJlcigxKSJ9.KPCnzpGInmuOoByGoIJ/mfiAmnQjgpVYQLmZo6DYjI4=" "http://0.0.0.0:8080/api/users/me"
Response
{
"created_at": "2017-01-12T20:35:38+0100",
"deleted_at": null,
"email": "cr@nodes.dk",
"id": 1,
"name": "Casper",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE0ODQyNTM3MzIsInN1YiI6Im51bWJlcigxKSJ9.06X3LOa20U/Ezpo4qdKbFHd5xjqBBtM+Pfkjob+Fyqk=",
"updated_at": "2017-01-12T20:35:38+0100"
}
CURL
curl -X PATCH -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE0ODQyNTUxNTQsInN1YiI6Im51bWJlcigxKSJ9./62Xg5sZvVIbM12wvzhmjins35x9+kZqyvDWlKk/j1c=" -H "Content-Type: multipart/form-data" -F "email=cr@nodes.dk" -F "password=TestTest123" "http://0.0.0.0:8080/api/users/token/regenerate"
Response
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE0ODQyNTUxNjUsInN1YiI6Im51bWJlcigxKSJ9.MBshiGEcOzonAEvxbf5OFDOU2lpXMBICEVpjtj7bjVQ="
}
CURL
curl -X GET -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE0ODQyNTUxNTQsInN1YiI6Im51bWJlcigxKSJ9./62Xg5sZvVIbM12wvzhmjins35x9+kZqyvDWlKk/j1c=" "http://0.0.0.0:8080/api/v1/users/logout"
Response
{
"success": true
}
This package is developed and maintained by the Vapor team at Nodes. The package owner for this project is Siemen.
This package is open-sourced software licensed under the MIT license