EsperoTech / yaade

Yaade is an open-source, self-hosted, collaborative API development environment.
MIT License
1.6k stars 71 forks source link

Question: How to test an API with credentials? #208

Open jhjacobs81 opened 2 weeks ago

jhjacobs81 commented 2 weeks ago

Is it possible to test an api with credentials? so i can post my login details to /api/login and have it saved for future testing?

Or maybe i am overlooking something?

jonrosner commented 2 weeks ago

What kind of authentication system do you use? If you use something token based than you can simply store the token in an environment.

jhjacobs81 commented 2 weeks ago

hello Jon, thank you for responding :)

currently i do this: curl -c cookies.txt -X POST http://127.0.0.1:8080/login -H "Content-Type: application/json" -d '{ "Username": "user", "Password": "password" }'

which will generate a cookies.txt like this: 127.0.0.1:8080 FALSE / TRUE 1733555692 AppName MTczMDk2MzY5M3xEWDhFQVFMX2dBQUJFQUVRQUFBZl80QUFBUVp6ZEhKcGJtY01DUUFIZFhObGNsOXBaQVIxYVc1MEJnSUFHQT09fLtMohuQTYQ_xjDYdRxghTX1E_2NRVIyfgtvCnppCpbW

and then on subsequent request i do this: curl -b cookies.txt -X POST http://127.0.0.1:8080/create -H "Content-Type: application/json" -d '{ "Username": "user1", "Password": "userpass" }'

its a session based webapp