miguelgrinberg / REST-auth

Example application for my RESTful Authentication with Flask article.
http://blog.miguelgrinberg.com/post/restful-authentication-with-flask
MIT License
921 stars 337 forks source link

How to test curl POST with token key and data ? #4

Closed JackLe1991 closed 5 years ago

JackLe1991 commented 7 years ago

How to test curl POST with token key and data ? Example: curl -H "Content-Type: application/json" -H "authToken: eyJhbGciOiJIUzI1NiIsImV4cCI6MTQ4OTk3ODY3MSwiaWF0IjoxNDg5OTc4MDcxfQ.eyJpZCI6MX0.wphF8H3o4p9r-DcynZr_6o_vxOccDaQVfcgQDOsUZrM" -d '{"username":"Test1","password":"adada"}' http://127.0.0.1:5000/api/users Result: Unauthorized Access

miguelgrinberg commented 7 years ago

Assuming you are using defaults, the command should be:

curl -H "Content-Type: application/json" -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsImV4cCI6MTQ4OTk3ODY3MSwiaWF0IjoxNDg5OTc4MDcxfQ.eyJpZCI6MX0.wphF8H3o4p9r-DcynZr_6o_vxOccDaQVfcgQDOsUZrM" -d '{"username":"Test1","password":"adada"}' http://127.0.0.1:5000/api/users
miguelgrinberg commented 5 years ago

This issue will be automatically closed due to being inactive for more than six months. Please reopen if you need more assistance.