Hi I am just getting started with django_rest_framework and I have I am trying to add a rest api to an existing site.
I have managed to implement a a function to get the token.
ie
curl -X POST -d "username=*****&password=*****" http://***.com/api-token-auth/
{"token":"549a12a6d4d2dc634e8a1bfbd73fa0dd9ab46890"}
However, when calling one on my methods to get data I get
curl -X GET https://************.com/pages/get_pages/ -H 'HTTP_AUTHORIZATION: Token 549a12a6d4d2dc634e8a1bfbd73fa0dd9ab46890'
{"detail":"Authentication credentials were not provided."}
On the server I inherited TokenAuthentication like so
class MyRestAuthentication(TokenAuthentication):
def authenticate(self, request):
print "MyRestAuthentication", request.META.items()
auth = get_authorization_header(request).split()
print auth
return super(MyRestAuthentication, self).authenticate(request)
I am printing out the headers but I don't see the HTTP_AUTHORIZATION header or any with my token.
What and I missing ?
Thanks