web-dev-qa-db-fra.com

Authentification par clé à jeton dans Postman

Comment effectuer l'appel d'authentification basé sur les jetons ci-dessous dans Postman?

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

Cela ne fonctionne pas:

enter image description here

Voici la sortie de l'appel curl:

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/
< 
17
dan-klasson

Ça devrait être:

ApiKey dan:ab104c54c6d06fa5bc17e38059c1b814ee9c3b43` 

Pas seulement:

dan:ab104c54c6d06fa5bc17e38059c1b814ee9c3b43

Dans l'en-tête Autorisation.

enter image description here

26
Matúš Bartko