Closed davidnierman closed 2 years ago
DR
Cannot display locations when running /index/ route in postman b/c there is some authentication error
from rest_framework.response import Response from rest_framework.permissions import IsAuthenticated # from rest_framework.authtoken.models import TokenAuthentication from rest_framework import generics from ..models.location import Location from ..serializers import LocationSerializer # Views class Locations(generics.ListCreateAPIView): # authentication_classes = [TokenAuthentication] # permission_classes=(IsAuthenticated) serializer_class = LocationSerializer def get(self): """Index request""" locations = Location.objects.all() data = LocationSerializer(locations, many=True).data return Response({ 'locations': data })
{ "detail": "Authentication credentials were not provided." }
the view/route does not know that it can receive a token. so even though i am sending the token it is not accepting it and throwing the error above
I have tried commenting out code that I thought was requiring authentication, but that did not work..
I have tried and I am still continuing to read the documentation here: Token Auth
Paste a link to your repository here composting-mgmt-systems-ap
https://github.com/sei-ec-remote/project-4-issues/issues/8 <-- is this this issue you're having?
https://stackoverflow.com/questions/53649252/django-rest-framework-basepermissionmetaclass-object-is-not-iterable
I was missing a comma see stack overflow comment above
What stack are you using?
(ex: MERN(mongoose + react), DR(django + react), PEN, etc.)
DR
What's the problem you're trying to solve?
Cannot display locations when running /index/ route in postman b/c there is some authentication error
Post any code you think might be relevant (one fenced block per file)
If you see an error message, post it here. If you don't, what unexpected behavior are you seeing?
{ "detail": "Authentication credentials were not provided." }
What is your best guess as to the source of the problem?
the view/route does not know that it can receive a token. so even though i am sending the token it is not accepting it and throwing the error above
What things have you already tried to solve the problem?
I have tried commenting out code that I thought was requiring authentication, but that did not work..
I have tried and I am still continuing to read the documentation here: Token Auth
Paste a link to your repository here composting-mgmt-systems-ap