Token key authentication in Postman

dan-klasson picture dan-klasson · Nov 8, 2014 · Viewed 35.2k times · Source

How do I make the below token based authentication call in Postman?

curl -H "Authorization: ApiKey dan:ab104c54c6d06fa5bc17e38059c1b814ee9c3b43" -F "image=/path_to_photo/image.jpg" http://localhost:8000/api/photo/ -v

This does not work:

enter image description here

This is the output of the curl call:

dan@dan-iMac:~/app$ curl -H "Authorization: ApiKey dan:ab104c54c6d06fa5bc17e38059c1b814ee9c3b43" -F "image=/path_to_photo/image.jpg" http://localhost:8000/api/photo/ -v
* Hostname was NOT found in DNS cache
*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 8000 (#0)
> POST /api/photo/ HTTP/1.1
> User-Agent: curl/7.35.0
> Host: localhost:8000
> Accept: */*
> Authorization: ApiKey dan:ab104c54c6d06fa5bc17e38059c1b814ee9c3b43
> Content-Length: 164
> Expect: 100-continue
> Content-Type: multipart/form-data; boundary=------------------------bbe8b5cf6a427342
> 
* Done waiting for 100-continue
* HTTP 1.0, assume close after body
< HTTP/1.0 201 CREATED
< Date: Sat, 08 Nov 2014 04:57:18 GMT
< Server: WSGIServer/0.1 Python/2.7.6
< Vary: Accept
< X-Frame-Options: SAMEORIGIN
< Content-Type: text/html; charset=utf-8
< Location: http://localhost:8000/api/photo/7/
< 

Answer

Mat&#250;š Bartko picture Matúš Bartko · Nov 8, 2014

It should be:

ApiKey dan:ab104c54c6d06fa5bc17e38059c1b814ee9c3b43` 

NOT just:

dan:ab104c54c6d06fa5bc17e38059c1b814ee9c3b43

In the Authorization header.

enter image description here