DEV Community

Discussion on: FullStack React & Django Authentication : Django REST ,TypeScript, Axios, Redux & React Router

Collapse
 
anjayluh profile image
Angella Naigaga • Edited

Thank you for coming up with this tutorials.
I am getting myself familiar with django so I landed on this tutorial to help me.
While following it, I encountered a couple of errors that i will mention here

  1. class RefreshViewSet(viewsets.ViewSet, TokenRefreshView):

There are two undefined vars here

  1. Add rest_framework_simplejwt.authentication.JWTAuthentication to the list of authentication classes in settings.py:

For my version of the app (I guess the recent django versions), the REST_FRAMEWORK object doesn't come included in settings.py. I had to add it myself

  1. If everything is working fine, let's create a user with an HTTP Client by requesting localhost:8000/api/auth/register/.

Here I ran into this error.
"""
ImproperlyConfigured at /api/auth/register/
Field name public_id is not valid for model User.
Request Method: POST
Request URL: localhost:8000/api/auth/register/
Django Version: 3.2.5
Exception Type: ImproperlyConfigured
Exception Value:

Field name public_id is not valid for model User.
Exception Location: /Users/anaconda3/lib/python3.8/site-packages/rest_framework/serializers.py, line 1317, in build_unknown_field
Python Executable: /Users/angellanaigaga/opt/anaconda3/bin/python
Python Version: 3.8.8
"""
My guess is it's coming from the serializers. At the point of writing this I am not sure how best to fix this bug, whether to rename public_id to id or remove it completely.

Otherwise, I appreciate the work well done

Collapse
 
anjayluh profile image
Angella Naigaga

Update
Renaming public_id to id fixes the last bug mentioned here

Collapse
 
koladev profile image
Mangabo Kolawole

typo fixed. Thanks again.

Collapse
 
koladev profile image
Mangabo Kolawole

Oh thanks Angella. I'll modify it