Cannot POST on the /users/ route while unlogged
To implement the registration from the frontend use case for Coopstarter, I need to be able to post the User info directly on the /users/
endpoint.
Request details:
curl 'http://127.0.0.1:8000/users/' -H 'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:65.0) Gecko/20100101 Firefox/65.0' -H 'Accept: */*' -H 'Accept-Language: en-US,en;q=0.5' --compressed -H 'Referer: http://localhost:9000/mentor-new-account' -H 'Content-Type: application/ld+json' -H 'Origin: http://localhost:9000' -H 'Connection: keep-alive' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache' --data '[{"@id":"./","http://happy-dev.fr/owl/#account":{"@id":"_:b69"},"http://happy-dev.fr/owl/#email":"benoit@paris.happy-dev.fr","http://happy-dev.fr/owl/#first_name":"Alez","http://happy-dev.fr/owl/#last_name":"Benito","http://happy-dev.fr/owl/#mentor_profile":{"@id":"_:b70"},"http://happy-dev.fr/owl/#password":"toto","http://happy-dev.fr/owl/#password_confirmation":"toto","http://happy-dev.fr/owl/#username":""},{"@id":"_:b69","http://happy-dev.fr/owl/#picture":""},{"@id":"_:b70","http://happy-dev.fr/owl/#biography":"Lorem ipsum","http://happy-dev.fr/owl/#city":"Colmar","http://happy-dev.fr/owl/#country":"FR","http://happy-dev.fr/owl/#headline":"Healine","http://happy-dev.fr/owl/#language":"FR","http://happy-dev.fr/owl/#linkedin":"https://linkedin.com/in/benoitalessandroni/","http://happy-dev.fr/owl/#organisation":1,"http://happy-dev.fr/owl/#phone":"02902932093","http://happy-dev.fr/owl/#skills":"Lorem ipsum","http://happy-dev.fr/owl/#twitter":"https://twitter.com/balessan/"}]'
Right now what I get is a 403 with this response body:
{"detail":"Authentication credentials were not provided.","@context":"https://cdn.happy-dev.fr/owl/hdcontext.jsonld"}
We should have a way to overwrite the permission class applied to the User model in our packages. Or a proper registration route at our disposal.
I tried the following addition to my models.py
:
from django.contrib.auth.models import User
User._meta.permission_classes = ()
But no luck.