<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ayoola Tosin</title>
    <description>The latest articles on DEV Community by Ayoola Tosin (@azureben).</description>
    <link>https://dev.to/azureben</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F362407%2Fb15b88d8-1a28-4cee-822a-a2d99f15238c.jpg</url>
      <title>DEV Community: Ayoola Tosin</title>
      <link>https://dev.to/azureben</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/azureben"/>
    <language>en</language>
    <item>
      <title>CSRF verification failed. Request aborted. in django rest framework</title>
      <dc:creator>Ayoola Tosin</dc:creator>
      <pubDate>Tue, 09 Aug 2022 14:37:00 +0000</pubDate>
      <link>https://dev.to/azureben/csrf-verification-failed-request-aborted-in-django-rest-framework-d8d</link>
      <guid>https://dev.to/azureben/csrf-verification-failed-request-aborted-in-django-rest-framework-d8d</guid>
      <description>&lt;p&gt;halo i'm working on a project, using drf, but i'm getting CSRF verification failed. Request aborted at first everything was working, but now when i test my api i keep keep getting,CSRF verification failed below is my setting &amp;amp; view  codes&lt;/p&gt;

&lt;p&gt;settings file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;REST_FRAMEWORK = {

    DEFAULT_AUTHENTICATION_CLASSES': (
        'rest_framework_simplejwt.authentication.JWTAuthentication
   ),

    'DATE_INPUT_FORMATS': [("%Y-%m-%d")],
    'DEFAULT_PERMISSION_CLASSES': (
        'rest_framework.permissions.IsAuthenticated'
    ),

    'DEFAULT_PARSER_CLASSES': (
        'rest_framework.parsers.JSONParser',
        'rest_framework.parsers.FormParser',
        'rest_framework.parsers.MultiPartParser',
    ),
    'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
    'PAGE_SIZE': 100

}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;views&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class createProfileView(generics.CreateAPIView):
    queryset = UserProfile.objects.all()
    serializer_class   = UserProfileSerializer
    permission_classes= [permissions.IsAuthenticated]
    parser_classes = (MultiPartParser, FormParser)

    def create(self,request, *args, **kwargs):
        serializer = self.get_serializer(
            data=request.data, instance = request.user.user_profile 
        )
        serializer.is_valid(raise_exception=True)
        self.perform_create(serializer)
        headers = self.get_success_headers(serializer.data)
        res  = {
            'msg' : 'Profile successfully created',
            'status':status.HTTP_201_CREATED,
            'headers': headers,
            'data': serializer.data,

        }
        return Response(res)

    def perform_create(self, serializer):
        serializer.save(user=self.request.user)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;can anyone help&lt;/p&gt;

</description>
      <category>question</category>
      <category>django</category>
      <category>csrf</category>
      <category>drf</category>
    </item>
  </channel>
</rss>
