neomad-team / neomad.org

Platform for nomad workers.
https://neomad.org
15 stars 4 forks source link

change response login api #307

Closed fuentesloic closed 6 years ago

fuentesloic commented 6 years ago

the only thing I know is this command: curl -i -X POST -H "Content-Type: application/json" -d '{"email":"your@email.com","password":"YOUR PASSWORD"}' https://neomad.org/api/login works but return the https://neomad.org/api/login html page.

So I change (or try to change) the response method :)

vinyll commented 6 years ago

Passing the appropriate arguments to cURL makes it work as expected:

curl -i -X POST -d "email=your@email.com&password=YOUR PASSWORD" localhost:5000/api/login/
HTTP/1.0 401 UNAUTHORIZED
Content-Type: application/json
Content-Length: 23
Server: Werkzeug/0.14.1 Python/3.6.6
Date: Thu, 30 Aug 2018 15:16:14 GMT

{
  "success": false
}

cURL alternatives

You may want to play with httpie instead:

http -f POST :5000/api/login/ email=your@email.com password=test

Or postman.

Therefore I'm not sure what this PR does 🤔

fuentesloic commented 6 years ago

@vinyll it's not working with neomad.org/api/login or https://neomad.org

vinyll commented 6 years ago

@fuentesloic, I've updated the server and it now works from Neomad.org

 http -f POST https://neomad.org/api/login/ email=your@email.com password=test
HTTP/1.1 401 UNAUTHORIZED
Connection: keep-alive
Content-Length: 23
Content-Type: application/json
Date: Mon, 03 Sep 2018 08:27:20 GMT
Server: nginx/1.13.12

{
    "success": false
}