title: Custom response for invalid token authentication in Django rest framework
body: <p>For the following piece of code, I would like to return a boolean corresponding to whether the user was authenticated or not.</p>
  
  <pre><code>class UserAuthenticatedView(APIView):
      authentication_classes = (TokenAuthentication,)
      permission_classes = (AllowAny,)
      def get(self, request, format=None):
          is_authenticated = request.user.is_authenticated()
          resp = {'is_authenticated': is_authenticated}
          return Response(resp, content_type="application/json", status=status.HTTP_200_OK)
  </code></pre>
  
  <p>However, for invalid token, the control is not not even going inside <code>get</code> method due to which I'm not able to customize the response. In such a case I'm getting the response: <code>{'detail': 'invalid token'}</code>,
  Any idea on how to customize the response for invalid token ?</p>