As a full-stack developer, understand how to build an authentication system with backend technology and manage the authentication flow with a front...
For further actions, you may consider blocking this person and/or reporting abuse
@koladev I have also realised that when running the command
$ yarn start after adding the craco.config.js file the following error is thrown
After a bit of digging i found this article
github.com/facebook/create-react-a...
basicly replacing the following line in the croca.config.js file solves this issue.
Thank you
@Mangabo Thanks for this amazing and insightful article I have learnt alot. However, i can't figure out why i can't login superusers in Django admin..getting an alert of
"
Please enter the correct email and password for a staff account. Note that both fields may be case-sensitive.
"
On terminal the following message is returned from the server
Kindly any one with an idea of what might be the issue?
Hi Edward. Thank you very much for your feedback. Let me try the code and come back to you.
Interestingly, I cloned the source code from Github and setup the project. I can actually connect in the admin dashboard, but with my
email
, and not theusername
.I think that I created this confusion tho as I only wanted the user to connect with the email.
In the
User
model, you can set these attributes so any user can connect with username and email.Please, let me know if it works.
Hi Mangambo, i made the changes. However was still facing the same issue. I decided to change the Model as of below and it worked.
Thanks for the article.
Thanks for this awesome tutorial!! Is there a way to make the auth/register only available to super users? That way if the app is public facing, not just anyone can create themselves as a user. Any tips or advice for this?
I think I just now figured it out. I updated the permission_classes for the registrationviewset. :)
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
There are two undefined vars here
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
Here I ran into this error.
"""
ImproperlyConfigured at /api/auth/register/
Field name
public_id
is not valid for modelUser
.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 modelUser
.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
Update
Renaming public_id to id fixes the last bug mentioned here
Oh thanks Angella. I'll modify it
typo fixed. Thanks again.
Thanks for the guide! Is anyone else getting a “CSRF cookie not set” error? I tried putting @csrf_exempt as a decorator above the create method in the RegistrationViewSet but that didn’t fix it.
With Django/Vue/Axios I have such something in Axios settings:
axios.defaults.withCredentials = true
axios.defaults.xsrfHeaderName = "X-CSRFTOKEN"
axios.defaults.xsrfCookieName = "csrftoken"
Hey Michael!
What's your CORS configuration? And are you using React?
Hey! Yup, I’m using React, testing in the browser and in Postman. I’m running on port 8000 so I have :
CORS_ALLOWED_ORIGINS = [“127.0.0.1:8000”,
“localhost:8000”]
CORS_ALLOW_HEADERS = [‘Accept’, ‘Accept-Language’, ‘Authorization’, ‘Content-Type’]
CORS_ALLOW_METHODS = [‘GET’, ‘POST’, ‘PUT’]
Awesome! Thank you!
You are welcome mate
It was an amazing and very well written article. Looking forward for more content from you.
Thanks Karan.
For sure, more content are coming.
Good one!
Thanks
Nice .. 🚀🚀
Thanks Sm0ke 🤓
Awesome!
Thank you Luca!
I Want the HTTPS link to git clone Please ...
Did you run this project?
hi Thank you very much for your feedback i got an error when i was building de react app
Thanks, very helpful tutorial.
I download this project from github.
But I can't run.
Please help me