當它工作的要求傳遞值作爲參數:如何設置tastypie的授權標頭?
curl "http://localhost:8080/wordgame/api/v1/rounds/?username=test_user&api_key=12345678907a9cb56b7290223165e0a7c23623df&format=json"
然而,當我試圖通過在作爲標題值這是行不通的。這導致401:
curl -H "Authorization: ApiKey test_user:12345678907a9cb56b7290223165e0a7c23623df" -H "Accept: application/json" http://localhost:8080/wordgame/api/v1/rounds/
我使用Tastypie ApiKeyAuthentication
您使用哪種版本的tastypie?你可以運行相同的詳細(-v)。如果它沒有幫助,我建議使用IDE進行一些調試,看看ApiKeyAuthentication的is_authenticated方法會發生什麼。 – 2012-07-28 22:18:50