mirror of
https://github.com/notrab/dumbo.git
synced 2025-01-17 22:28:25 +01:00
817 B
817 B
JWT Auth Example
This example demonstrates how to use JWT authentication in Dumbo.
Running the Example
-
Install dependencies:
composer install
-
Start the server:
composer start
-
Access the public route:
curl http://localhost:8000
-
Try to access the protected route (should fail):
curl http://localhost:8000/protected
-
Login:
curl -X POST -H "Content-Type: application/json" -d '{"username":"user1","password":"password1"}' http://localhost:8000/login -c cookies.txt
-
Access the protected route with the JWT cookie:
curl http://localhost:8000/protected -b cookies.txt
-
Logout:
curl -X POST http://localhost:8000/logout -b cookies.txt