0
oos経由でoscarapi呼び出しを呼び出すと、私はうんざりした問題に直面しています。それはPOSTMANとうまくいっています。しかし、xcodeを呼び出すと、次のエラーが表示されます。django restフレームの作業:oscarapi認証が機能していない
HTTP/1.1 401 Authorization Required
Connection: Keep-Alive
Content-Type: application/json
Server: Apache/2.4.7 (Ubuntu)
Allow: GET, HEAD, OPTIONS
Vary: Accept,Authorization,Cookie
Date: Thu, 20 Apr 2017 13:55:13 GMT
X-Frame-Options: SAMEORIGIN
Www-Authenticate: Bearer realm="api"
Keep-Alive: timeout=5, max=100
Transfer-Encoding: Identity
{"detail":"Authentication credentials were not provided."}
私は次のように見出しの認証を送信します。これは郵便配達員でうまくいきます。
Authorization: Bearer iw7cGIz4uF036j7VbpGCXbceCCbbD1
私urls.py
url(r'^api/v1/categories', views.CategoryListCustom.as_view(), name='category-list')
views.py
class CategoryListCustomd(generics.ListAPIView):
def get_queryset(self):
queryset = Category.objects.all()
return queryset
serializer_class = CustomCategorySerializer
今はうまく動作しています。ありがとう –