Token key authentication in Postman
Asked Answered
T

1

17

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/
< 
Toreutic answered 8/11, 2014 at 5:34 Comment(1)
The Authorization in -H goes in Headers section, not formAgamete
G
28

It should be:

ApiKey dan:ab104c54c6d06fa5bc17e38059c1b814ee9c3b43` 

NOT just:

dan:ab104c54c6d06fa5bc17e38059c1b814ee9c3b43

In the Authorization header.

enter image description here

Gender answered 8/11, 2014 at 12:32 Comment(2)
I've tried that as well. It didn't work either. Is that how you connect? If so, can you please post your code as well?Toreutic
I didn't read that properly. I had it in the post instead of header. That must have been the problem.Toreutic

© 2022 - 2024 — McMap. All rights reserved.