2014-11-08 4 views
13

우편 배달부에서 아래의 토큰 기반 인증 호출을 어떻게 작성합니까?우편 배달원의 토큰 키 인증

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

이 작동하지 않습니다

[email protected]:~/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/ 
< 
+2

-H의 권한 부여 나뿐만 아니라 것을 시도했다 –

답변

19

그것은해야한다 :

ApiKey dan:ab104c54c6d06fa5bc17e38059c1b814ee9c3b43` 

하지

enter image description here

이이 (가) curl 호출의 출력 바로 :

dan:ab104c54c6d06fa5bc17e38059c1b814ee9c3b43 

인증 헤더에 있습니다.

enter image description here

+0

을 형성하지, 헤더 섹션에 간다. 그것도 작동하지 않았다. 그게 당신이 연결하는 방법인가요? 그렇다면 코드를 올리시겠습니까? –

+1

제대로 읽지 못했습니다. 나는 머리글 대신 포스트에 넣었다. 그것은 문제 였음에 틀림 없다. –