0

I'm making an internal API with TastyPie. I have

from tastypie.resources import ModelResource
from tastypie.authentication import ApiKeyAuthentication
from myapp.movie.models import Movie


class MovieResource(ModelResource):
    class Meta:
        queryset = Movie.objects.all()
        resource_name = 'movie'
        authentication = ApiKeyAuthentication()

With Auth rules disabled, my API works great. With it on, I get a 401 (UNAUTHORIZED) response.

URL is

http://127.0.0.1:8000/api/movie/?format=json

thank you

UPDATE: I've same problem. Django Tastypie: How to Authenticate with API Key

Community
  • 1
  • 1

1 Answers1

2

You need to actually provide the API Key with your request.

You mentioned the following URL:

http://127.0.0.1:8000/api/movie/?format=json

but since you didn't say otherwise I assume it's GET and therefore it should include the api key, for example:

http://127.0.0.1:8000/api/movie/?format=json&api_key=123456789adfljafal

If this doesn't help, please provide more information.

kgr
  • 9,750
  • 2
  • 38
  • 43